From: Pavel Charvat Date: Thu, 21 Jun 2007 12:18:53 +0000 (+0200) Subject: The great conversion of log() logging function to msg(). X-Git-Tag: holmes-import~506^2~69 X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=0a3c6e75d7bf2f7d79a1e448c343946f689e6ba1;p=libucw.git The great conversion of log() logging function to msg(). Sherlock.h still defines log() alias to UCW's msg(). Lib/math.h has been moved to sherlock/math.h. --- diff --git a/images/color.c b/images/color.c index ee1525e0..8003c7be 100644 --- a/images/color.c +++ b/images/color.c @@ -10,7 +10,7 @@ #undef LOCAL_DEBUG #include "sherlock/sherlock.h" -#include "lib/math.h" +#include "sherlock/math.h" #include "images/images.h" #include "images/color.h" #include "images/error.h" diff --git a/images/context.c b/images/context.c index 6281ba3c..baebb9b8 100644 --- a/images/context.c +++ b/images/context.c @@ -35,7 +35,7 @@ image_context_cleanup(struct image_context *ctx) void image_context_msg_default(struct image_context *ctx) { - log(ctx->msg_code >> 24, "%s", ctx->msg); + msg(ctx->msg_code >> 24, "%s", ctx->msg); } void diff --git a/images/hilbert-test.c b/images/hilbert-test.c index 9824f092..ce2466c2 100644 --- a/images/hilbert-test.c +++ b/images/hilbert-test.c @@ -4,9 +4,9 @@ #include "lib/lib.h" #include "lib/mempool.h" -#include "lib/math.h" #include #include +#include static struct mempool *pool; diff --git a/images/image-sim-test.c b/images/image-sim-test.c index 1a549091..d4875887 100644 --- a/images/image-sim-test.c +++ b/images/image-sim-test.c @@ -68,7 +68,7 @@ static byte *segmentation_name_2; static uns display_base64; static uns display_base224; -#define MSG(x...) do{ if (verbose) log(L_INFO, ##x); }while(0) +#define MSG(x...) do{ if (verbose) msg(L_INFO, ##x); }while(0) #define TRY(x) do{ if (!(x)) exit(1); }while(0) static void diff --git a/images/image-tool.c b/images/image-tool.c index e1717569..b211f196 100644 --- a/images/image-tool.c +++ b/images/image-tool.c @@ -84,7 +84,7 @@ parse_color(struct color *color, byte *s) color_make_rgb(color, (v >> 16) & 255, (v >> 8) & 255, v & 255); } -#define MSG(x...) do{ if (verbose) log(L_INFO, ##x); }while(0) +#define MSG(x...) do{ if (verbose) msg(L_INFO, ##x); }while(0) int main(int argc, char **argv) diff --git a/images/sig-cmp.c b/images/sig-cmp.c index b420f067..c663c2b3 100644 --- a/images/sig-cmp.c +++ b/images/sig-cmp.c @@ -10,7 +10,6 @@ #undef LOCAL_DEBUG #include "lib/lib.h" -#include "lib/math.h" #include "images/math.h" #include "images/images.h" #include "images/signature.h" diff --git a/images/sig-init.c b/images/sig-init.c index 57eaa71b..4c45556c 100644 --- a/images/sig-init.c +++ b/images/sig-init.c @@ -10,9 +10,9 @@ #undef LOCAL_DEBUG #include "sherlock/sherlock.h" +#include "sherlock/math.h" #include "lib/fastbuf.h" #include "lib/conf.h" -#include "lib/math.h" #include "images/images.h" #include "images/math.h" #include "images/error.h" diff --git a/lib/Makefile b/lib/Makefile index 8cc43c14..08fe41b2 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -34,7 +34,7 @@ LIBUCW_MODS= \ getopt LIBUCW_INCLUDES= \ - lib.h config.h threads.h math.h \ + lib.h config.h threads.h \ mempool.h pagecache.h \ sorter.h sorter-globals.h arraysort.h \ lists.h clists.h slists.h simple-lists.h \ diff --git a/lib/bitsig.c b/lib/bitsig.c index 9b072e1f..8ffe8dbc 100644 --- a/lib/bitsig.c +++ b/lib/bitsig.c @@ -72,7 +72,7 @@ bitsig_init(uns perrlog, uns maxn) b->maxn = maxn; b->max_m_mult = (0xffffffff / m) * m; bzero(b->array, mbytes); - log(L_DEBUG, "Initialized bitsig array with l=%d, m=%u (%u KB), expecting %d items", b->l, b->m, (mbytes+1023)/1024, maxn); + msg(L_DEBUG, "Initialized bitsig array with l=%d, m=%u (%u KB), expecting %d items", b->l, b->m, (mbytes+1023)/1024, maxn); return b; } @@ -139,7 +139,7 @@ bitsig_insert(struct bitsig *b, byte *item) } } if (!was && b->n++ == b->maxn+1) - log(L_ERROR, "bitsig: Too many items inserted, error rate will be higher than estimated!"); + msg(L_ERROR, "bitsig: Too many items inserted, error rate will be higher than estimated!"); return was; } diff --git a/lib/conf-input.c b/lib/conf-input.c index d7e7766e..260d9f2a 100644 --- a/lib/conf-input.c +++ b/lib/conf-input.c @@ -141,31 +141,31 @@ get_word(uns is_command_name) } static byte * -get_token(uns is_command_name, byte **msg) +get_token(uns is_command_name, byte **err) { - *msg = NULL; + *err = NULL; while (1) { if (!*line || *line == '#') { - if (!is_command_name || !get_line(msg)) + if (!is_command_name || !get_line(err)) return NULL; } else if (*line == ';') { - *msg = get_word(0); - if (!is_command_name || *msg) + *err = get_word(0); + if (!is_command_name || *err) return NULL; } else if (*line == '\\' && !line[1]) { - if (!get_line(msg)) { - if (!*msg) - *msg = "Last line ends by a backslash"; + if (!get_line(err)) { + if (!*err) + *err = "Last line ends by a backslash"; return NULL; } if (!*line || *line == '#') - log(L_WARN, "The line %s:%d following a backslash is empty", name_parse_fb ? : (byte*) "", line_num); + msg(L_WARN, "The line %s:%d following a backslash is empty", name_parse_fb ? : (byte*) "", line_num); } else { split_grow(&word_buf, words+1); uns start = copied; word_buf.ptr[words++] = copied; - *msg = get_word(is_command_name); - return *msg ? NULL : copy_buf.ptr + start; + *err = get_word(is_command_name); + return *err ? NULL : copy_buf.ptr + start; } } } @@ -197,7 +197,7 @@ split_command(void) static byte * parse_fastbuf(const byte *name_fb, struct fastbuf *fb, uns depth) { - byte *msg; + byte *err; name_parse_fb = name_fb; parse_fb = fb; line_num = 0; @@ -205,8 +205,8 @@ parse_fastbuf(const byte *name_fb, struct fastbuf *fb, uns depth) *line = 0; while (1) { - msg = split_command(); - if (msg) + err = split_command(); + if (err) goto error; if (!words) return NULL; @@ -217,23 +217,23 @@ parse_fastbuf(const byte *name_fb, struct fastbuf *fb, uns depth) if (!strcasecmp(name, "include")) { if (words != 2) - msg = "Expecting one filename"; + err = "Expecting one filename"; else if (depth > 8) - msg = "Too many nested files"; + err = "Too many nested files"; else if (*line && *line != '#') // because the contents of line_buf is not re-entrant and will be cleared - msg = "The input command must be the last one on a line"; - if (msg) + err = "The input command must be the last one on a line"; + if (err) goto error; struct fastbuf *new_fb = bopen_try(pars[0], O_RDONLY, 1<<14); if (!new_fb) { - msg = cf_printf("Cannot open file %s: %m", pars[0]); + err = cf_printf("Cannot open file %s: %m", pars[0]); goto error; } uns ll = line_num; - msg = parse_fastbuf(stk_strdup(pars[0]), new_fb, depth+1); + err = parse_fastbuf(stk_strdup(pars[0]), new_fb, depth+1); line_num = ll; bclose(new_fb); - if (msg) + if (err) goto error; parse_fb = fb; continue; @@ -259,23 +259,23 @@ parse_fastbuf(const byte *name_fb, struct fastbuf *fb, uns depth) default: op = OP_SET; break; } if (strcasecmp(c, cf_op_names[op])) { - msg = cf_printf("Unknown operation %s", c); + err = cf_printf("Unknown operation %s", c); goto error; } } if (ends_by_brace) op |= OP_OPEN; - msg = cf_interpret_line(name, op, words-1, pars); - if (msg) + err = cf_interpret_line(name, op, words-1, pars); + if (err) goto error; } error: if (name_fb) - log(L_ERROR, "File %s, line %d: %s", name_fb, line_num, msg); + msg(L_ERROR, "File %s, line %d: %s", name_fb, line_num, err); else if (line_num == 1) - log(L_ERROR, "Manual setting of configuration: %s", msg); + msg(L_ERROR, "Manual setting of configuration: %s", err); else - log(L_ERROR, "Manual setting of configuration, line %d: %s", line_num, msg); + msg(L_ERROR, "Manual setting of configuration, line %d: %s", line_num, err); return "included from here"; } @@ -305,12 +305,12 @@ load_file(const byte *file) cf_init_stack(); struct fastbuf *fb = bopen_try(file, O_RDONLY, 1<<14); if (!fb) { - log(L_ERROR, "Cannot open %s: %m", file); + msg(L_ERROR, "Cannot open %s: %m", file); return 1; } - byte *msg = parse_fastbuf(file, fb, 0); + byte *err_msg = parse_fastbuf(file, fb, 0); bclose(fb); - int err = !!msg || done_stack(); + int err = !!err_msg || done_stack(); if (!err) cf_def_file = NULL; return err; diff --git a/lib/conf-intr.c b/lib/conf-intr.c index 8bc06f82..827a935c 100644 --- a/lib/conf-intr.c +++ b/lib/conf-intr.c @@ -637,7 +637,7 @@ int cf_check_stack(void) { if (level > 0) { - log(L_ERROR, "Unterminated block"); + msg(L_ERROR, "Unterminated block"); return 1; } return 0; diff --git a/lib/conf-section.c b/lib/conf-section.c index e4a0712f..2851d26d 100644 --- a/lib/conf-section.c +++ b/lib/conf-section.c @@ -164,14 +164,14 @@ commit_section(struct cf_section *sec, void *ptr, uns commit_all) for (struct cf_item *ci=sec->cfg; ci->cls; ci++) if (ci->cls == CC_SECTION) { if ((err = commit_section(ci->u.sec, ptr + (uintptr_t) ci->ptr, commit_all))) { - log(L_ERROR, "Cannot commit section %s: %s", ci->name, err); + msg(L_ERROR, "Cannot commit section %s: %s", ci->name, err); return "commit of a subsection failed"; } } else if (ci->cls == CC_LIST) { uns idx = 0; CLIST_FOR_EACH(cnode *, n, * (clist*) (ptr + (uintptr_t) ci->ptr)) if (idx++, err = commit_section(ci->u.sec, n, commit_all)) { - log(L_ERROR, "Cannot commit node #%d of list %s: %s", idx, ci->name, err); + msg(L_ERROR, "Cannot commit node #%d of list %s: %s", idx, ci->name, err); return "commit of a list failed"; } } diff --git a/lib/fb-file.c b/lib/fb-file.c index 637446a0..dd8d1488 100644 --- a/lib/fb-file.c +++ b/lib/fb-file.c @@ -71,7 +71,7 @@ bfd_close(struct fastbuf *f) { case 1: if (unlink(f->name) < 0) - log(L_ERROR, "unlink(%s): %m", f->name); + msg(L_ERROR, "unlink(%s): %m", f->name); case 0: close(FB_FILE(f)->fd); } @@ -160,7 +160,7 @@ bfilesync(struct fastbuf *b) { bflush(b); if (fsync(FB_FILE(b)->fd) < 0) - log(L_ERROR, "fsync(%s) failed: %m", b->name); + msg(L_ERROR, "fsync(%s) failed: %m", b->name); } #ifdef TEST diff --git a/lib/fb-mmap.c b/lib/fb-mmap.c index 948dcf58..28e90df4 100644 --- a/lib/fb-mmap.c +++ b/lib/fb-mmap.c @@ -145,7 +145,7 @@ bfmm_close(struct fastbuf *f) { case 1: if (unlink(f->name) < 0) - log(L_ERROR, "unlink(%s): %m", f->name); + msg(L_ERROR, "unlink(%s): %m", f->name); case 0: close(F->fd); } diff --git a/lib/lib.h b/lib/lib.h index 2230a8cd..4eeab682 100644 --- a/lib/lib.h +++ b/lib/lib.h @@ -99,9 +99,8 @@ extern void (*log_die_hook)(void); struct tm; extern void (*log_switch_hook)(struct tm *tm); -void log_msg(uns cat, const char *msg, ...) FORMAT_CHECK(printf,2,3); -#define log log_msg -void vlog_msg(uns cat, const char *msg, va_list args); +void msg(uns cat, const char *fmt, ...) FORMAT_CHECK(printf,2,3); +void vmsg(uns cat, const char *fmt, va_list args); void die(const char *, ...) NONRET FORMAT_CHECK(printf,1,2); void log_init(const char *argv0); void log_file(const char *name); @@ -120,7 +119,7 @@ void assert_failed_noinfo(void) NONRET; #define COMPILE_ASSERT(name,x) typedef char _COMPILE_ASSERT_##name[!!(x)-1] #ifdef LOCAL_DEBUG -#define DBG(x,y...) log(L_DEBUG, x,##y) +#define DBG(x,y...) msg(L_DEBUG, x,##y) #else #define DBG(x,y...) do { } while(0) #endif diff --git a/lib/lizard-safe.c b/lib/lizard-safe.c index 3b927831..e8e8f6fa 100644 --- a/lib/lizard-safe.c +++ b/lib/lizard-safe.c @@ -93,7 +93,7 @@ lizard_decompress_safe(const byte *in, struct lizard_buffer *buf, uns expected_l } else { - log(L_ERROR, "SIGSEGV caught in lizard_decompress()"); + msg(L_ERROR, "SIGSEGV caught in lizard_decompress()"); ptr = NULL; errno = EFAULT; } diff --git a/lib/log.c b/lib/log.c index 8f56f06f..0063f3ea 100644 --- a/lib/log.c +++ b/lib/log.c @@ -26,7 +26,7 @@ void (*log_die_hook)(void); void (*log_switch_hook)(struct tm *tm); void -vlog_msg(unsigned int cat, const char *msg, va_list args) +vmsg(unsigned int cat, const char *fmt, va_list args) { struct timeval tv; struct tm tm; @@ -66,7 +66,7 @@ vlog_msg(unsigned int cat, const char *msg, va_list args) l0 = p - buf + 1; r = buflen - l0; va_copy(args2, args); - l = vsnprintf(p, r, msg, args2); + l = vsnprintf(p, r, fmt, args2); va_end(args2); if (l < 0) l = r; @@ -87,22 +87,22 @@ vlog_msg(unsigned int cat, const char *msg, va_list args) } void -log_msg(unsigned int cat, const char *msg, ...) +msg(unsigned int cat, const char *fmt, ...) { va_list args; - va_start(args, msg); - vlog_msg(cat, msg, args); + va_start(args, fmt); + vmsg(cat, fmt, args); va_end(args); } void -die(const char *msg, ...) +die(const char *fmt, ...) { va_list args; - va_start(args, msg); - vlog_msg(L_FATAL, msg, args); + va_start(args, fmt); + vmsg(L_FATAL, fmt, args); va_end(args); if (log_die_hook) log_die_hook(); @@ -116,7 +116,7 @@ die(const char *msg, ...) void assert_failed(const char *assertion, const char *file, int line) { - log(L_FATAL, "Assertion `%s' failed at %s:%d", assertion, file, line); + msg(L_FATAL, "Assertion `%s' failed at %s:%d", assertion, file, line); abort(); } diff --git a/lib/mainloop.c b/lib/mainloop.c index 5344dcad..aeb79de4 100644 --- a/lib/mainloop.c +++ b/lib/mainloop.c @@ -101,7 +101,7 @@ file_add(struct main_file *fi) main_file_cnt++; main_poll_table_obsolete = 1; if (fcntl(fi->fd, F_SETFL, O_NONBLOCK) < 0) - log(L_ERROR, "Error setting fd %d to non-blocking mode: %m. Keep fingers crossed.", fi->fd); + msg(L_ERROR, "Error setting fd %d to non-blocking mode: %m. Keep fingers crossed.", fi->fd); } void @@ -307,25 +307,25 @@ void main_debug(void) { #ifdef CONFIG_DEBUG - log(L_DEBUG, "### Main loop status on %lld", (long long)main_now); - log(L_DEBUG, "\tActive timers:"); + msg(L_DEBUG, "### Main loop status on %lld", (long long)main_now); + msg(L_DEBUG, "\tActive timers:"); struct main_timer *tm; CLIST_WALK(tm, main_timer_list) - log(L_DEBUG, "\t\t%p (expires %lld, data %p)", tm, (long long)(tm->expires ? tm->expires-main_now : 999999), tm->data); + msg(L_DEBUG, "\t\t%p (expires %lld, data %p)", tm, (long long)(tm->expires ? tm->expires-main_now : 999999), tm->data); struct main_file *fi; - log(L_DEBUG, "\tActive files:"); + msg(L_DEBUG, "\tActive files:"); CLIST_WALK(fi, main_file_list) - log(L_DEBUG, "\t\t%p (fd %d, rh %p, wh %p, eh %p, expires %lld, data %p)", + msg(L_DEBUG, "\t\t%p (fd %d, rh %p, wh %p, eh %p, expires %lld, data %p)", fi, fi->fd, fi->read_handler, fi->write_handler, fi->error_handler, (long long)(fi->timer.expires ? fi->timer.expires-main_now : 999999), fi->data); - log(L_DEBUG, "\tActive hooks:"); + msg(L_DEBUG, "\tActive hooks:"); struct main_hook *ho; CLIST_WALK(ho, main_hook_list) - log(L_DEBUG, "\t\t%p (func %p, data %p)", ho, ho->handler, ho->data); - log(L_DEBUG, "\tActive processes:"); + msg(L_DEBUG, "\t\t%p (func %p, data %p)", ho, ho->handler, ho->data); + msg(L_DEBUG, "\tActive processes:"); struct main_process *pr; CLIST_WALK(pr, main_process_list) - log(L_DEBUG, "\t\t%p (pid %d, data %p)", pr, pr->pid, pr->data); + msg(L_DEBUG, "\t\t%p (pid %d, data %p)", pr, pr->pid, pr->data); #endif } diff --git a/lib/math.h b/lib/math.h deleted file mode 100644 index f891a210..00000000 --- a/lib/math.h +++ /dev/null @@ -1,20 +0,0 @@ -/* - * UCW Library -- Stub for including math.h, avoiding name collisions - * - * (c) 2003 Martin Mares - * - * This software may be freely distributed and used according to the terms - * of the GNU Lesser General Public License. - */ - -#undef log -#define log libm_log -#define exception math_exception -#include -#undef log -#define log log_msg -#undef exception - -#ifdef CONFIG_LINUX -float logf(float); -#endif diff --git a/lib/qache.c b/lib/qache.c index acf0bb1e..095925df 100644 --- a/lib/qache.c +++ b/lib/qache.c @@ -291,14 +291,14 @@ qache_open_existing(struct qache *q, struct qache_params *par) goto unlock_and_fail; qache_unlock(q, 0); - log(L_INFO, "Cache %s: using existing data", q->file_name); + msg(L_INFO, "Cache %s: using existing data", q->file_name); return 1; unlock_and_fail: qache_unlock(q, 0); munmap(q->mmap_data, q->file_size); close_and_fail: - log(L_INFO, "Cache %s: ignoring old contents (%s)", q->file_name, err); + msg(L_INFO, "Cache %s: ignoring old contents (%s)", q->file_name, err); close(q->fd); return 0; } @@ -370,7 +370,7 @@ qache_create(struct qache *q, struct qache_params *par) ASSERT(btell(fb) == (sh_off_t)par->cache_size); bclose(fb); - log(L_INFO, "Cache %s: created (%d bytes, %d slots, %d buckets)", q->file_name, par->cache_size, h.max_entries, h.hash_size); + msg(L_INFO, "Cache %s: created (%d bytes, %d slots, %d buckets)", q->file_name, par->cache_size, h.max_entries, h.hash_size); if ((q->mmap_data = mmap(NULL, par->cache_size, PROT_READ | PROT_WRITE, MAP_SHARED, q->fd, 0)) == MAP_FAILED) die("Cache %s: mmap failed (%m)", par->file_name); @@ -402,7 +402,7 @@ qache_close(struct qache *q, uns retain_data) munmap(q->mmap_data, q->file_size); close(q->fd); if (!retain_data && unlink(q->file_name) < 0) - log(L_ERROR, "Cache %s: unlink failed (%m)", q->file_name); + msg(L_ERROR, "Cache %s: unlink failed (%m)", q->file_name); xfree(q->file_name); xfree(q); } @@ -702,26 +702,26 @@ qache_delete(struct qache *q, qache_key_t *key, uns pos_hint) void qache_debug(struct qache *q) { - log(L_DEBUG, "Cache %s: block_size=%d (%d data), num_blocks=%d (%d first data), %d slots, %d hash buckets", + msg(L_DEBUG, "Cache %s: block_size=%d (%d data), num_blocks=%d (%d first data), %d slots, %d hash buckets", q->file_name, q->hdr->block_size, q->hdr->block_size, q->hdr->num_blocks, q->hdr->first_data_block, q->hdr->max_entries, q->hdr->hash_size); - log(L_DEBUG, "Table of cache entries:"); - log(L_DEBUG, "\tEntry\tLruPrev\tLruNext\tDataLen\tDataBlk\tHashNxt\tKey"); + msg(L_DEBUG, "Table of cache entries:"); + msg(L_DEBUG, "\tEntry\tLruPrev\tLruNext\tDataLen\tDataBlk\tHashNxt\tKey"); for (uns e=0; ehdr->max_entries; e++) { struct qache_entry *ent = &q->entry_table[e]; - log(L_DEBUG, "\t%d\t%d\t%d\t%d\t%d\t%d\t%s", e, ent->lru_prev, ent->lru_next, ent->data_len, + msg(L_DEBUG, "\t%d\t%d\t%d\t%d\t%d\t%d\t%s", e, ent->lru_prev, ent->lru_next, ent->data_len, ent->first_data_block, ent->hash_next, format_key(&ent->key)); } - log(L_DEBUG, "Hash table:"); + msg(L_DEBUG, "Hash table:"); for (uns h=0; hhdr->hash_size; h++) - log(L_DEBUG, "\t%04x\t%d", h, q->hash_table[h]); + msg(L_DEBUG, "\t%04x\t%d", h, q->hash_table[h]); - log(L_DEBUG, "Next pointers:"); + msg(L_DEBUG, "Next pointers:"); for (uns blk=q->hdr->first_data_block; blkhdr->num_blocks; blk++) - log(L_DEBUG, "\t%d\t%d", blk, q->next_table[blk]); + msg(L_DEBUG, "\t%d\t%d", blk, q->next_table[blk]); } void diff --git a/lib/runcmd.c b/lib/runcmd.c index de32b9b6..c18dcab1 100644 --- a/lib/runcmd.c +++ b/lib/runcmd.c @@ -36,7 +36,7 @@ exec_command_v(const byte *cmd, va_list args) execv(cmd, argv); byte echo[256]; echo_command_v(echo, sizeof(echo), cmd, args); - log(L_ERROR, "Cannot execute %s: %m", echo); + msg(L_ERROR, "Cannot execute %s: %m", echo); exit(255); } @@ -46,7 +46,7 @@ run_command_v(const byte *cmd, va_list args) pid_t p = fork(); if (p < 0) { - log(L_ERROR, "fork() failed: %m"); + msg(L_ERROR, "fork() failed: %m"); return 0; } else if (!p) @@ -54,15 +54,15 @@ run_command_v(const byte *cmd, va_list args) else { int stat; - byte msg[EXIT_STATUS_MSG_SIZE]; + byte status_msg[EXIT_STATUS_MSG_SIZE]; p = waitpid(p, &stat, 0); if (p < 0) die("waitpid() failed: %m"); - if (format_exit_status(msg, stat)) + if (format_exit_status(status_msg, stat)) { byte echo[256]; echo_command_v(echo, sizeof(echo), cmd, args); - log(L_ERROR, "`%s' failed: %s", echo, msg); + msg(L_ERROR, "`%s' failed: %s", echo, status_msg); return 0; } return 1; diff --git a/lib/shell/logger.c b/lib/shell/logger.c index def241f3..67315c9e 100644 --- a/lib/shell/logger.c +++ b/lib/shell/logger.c @@ -29,14 +29,14 @@ main(int argc, char **argv) else log_init(argv[1]); if (argc > 3) - log(argv[2][0], argv[3]); + msg(argv[2][0], argv[3]); else while (fgets(buf, sizeof(buf), stdin)) { c = strchr(buf, '\n'); if (c) *c = 0; - log(argv[2][0], buf); + msg(argv[2][0], buf); } return 0; } diff --git a/lib/sorter.h b/lib/sorter.h index 71fcff1e..eebd2206 100644 --- a/lib/sorter.h +++ b/lib/sorter.h @@ -230,7 +230,7 @@ P(pass)(struct fastbuf **fb1, struct fastbuf **fb2 bclose(in1); bclose(in2); if (sorter_trace) - log(L_INFO, "Pass %d: %d runs, %d+%d KB", sorter_pass_counter, run_count, + msg(L_INFO, "Pass %d: %d runs, %d+%d KB", sorter_pass_counter, run_count, (out1 ? (int)((btell(out1) + 1023) / 1024) : 0), (out2 ? (int)((btell(out2) + 1023) / 1024) : 0)); *fb1 = P(flush_out)(out1); @@ -300,7 +300,7 @@ P(presort)(struct fastbuf **fb1, struct fastbuf **fb2) bclose(in); if (sorter_trace) - log(L_INFO, "Pass 0: %d runs, %d+%d KB", + msg(L_INFO, "Pass 0: %d runs, %d+%d KB", run_count, (out1 ? (int)((btell(out1) + 1023) / 1024) : 0), (out2 ? (int)((btell(out2) + 1023) / 1024) : 0)); @@ -459,7 +459,7 @@ P(presort)(struct fastbuf **fb1, struct fastbuf **fb2) bclose(in); if (sorter_trace) - log(L_INFO, "Pass 0: %d runs (%d giants, %d splits), %d+%d KB", + msg(L_INFO, "Pass 0: %d runs (%d giants, %d splits), %d+%d KB", run_count, giant_count, split_count, (out1 ? (int)((btell(out1) + 1023) / 1024) : 0), (out2 ? (int)((btell(out2) + 1023) / 1024) : 0)); diff --git a/lib/sync.c b/lib/sync.c index 5faada81..a4c9b05a 100644 --- a/lib/sync.c +++ b/lib/sync.c @@ -24,5 +24,5 @@ sync_dir(const byte *name) if (err >= 0) return; err: - log(L_ERROR, "Unable to sync directory %s: %m", name); + msg(L_ERROR, "Unable to sync directory %s: %m", name); }