X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=src%2Flog.c;h=ed2e05e9f278e24927a432fb0c76da85bd619f8a;hb=e4ef95b2ccfe88d7049543664f00e5fda957dd0c;hp=956e321d6f970baa98740dd9b94e532c4d7b81d2;hpb=9776afc23d4a953d4baf399f9682f53baf4654fc;p=yaz-moved-to-github.git diff --git a/src/log.c b/src/log.c index 956e321..ed2e05e 100644 --- a/src/log.c +++ b/src/log.c @@ -1,8 +1,8 @@ /* - * Copyright (C) 1995-2006, Index Data ApS + * Copyright (C) 1995-2007, Index Data ApS * See the file LICENSE for details. * - * $Id: log.c,v 1.44 2007-01-01 22:39:08 adam Exp $ + * $Id: log.c,v 1.47 2007-02-20 09:39:17 adam Exp $ */ /** @@ -388,7 +388,7 @@ static void yaz_strftime(char *dst, size_t sz, #ifdef WIN32 DWORD tid = GetCurrentThreadId(); #else - long tid = 0; + pthread_t tid = 0; #if YAZ_POSIX_THREADS tid = pthread_self(); #endif @@ -444,14 +444,16 @@ static void yaz_log_to_file(int level, const char *log_message) level &= ~mask_names[i].mask; } } - - if (l_level & YLOG_NOTIME) - tbuf[0] = '\0'; - else - yaz_strftime(tbuf, TIMEFORMAT_LEN-1, l_actual_format, tm); - tbuf[TIMEFORMAT_LEN-1] = '\0'; - - fprintf(file, "%s %s%s %s%s\n", tbuf, l_prefix, flags, l_prefix2, + + tbuf[0] = '\0'; + if (!(l_level & YLOG_NOTIME)) + { + yaz_strftime(tbuf, TIMEFORMAT_LEN-2, l_actual_format, tm); + tbuf[TIMEFORMAT_LEN-2] = '\0'; + } + if (tbuf[0]) + strcat(tbuf, " "); + fprintf(file, "%s%s%s %s%s\n", tbuf, l_prefix, flags, l_prefix2, log_message); if (l_level & YLOG_FLUSH) fflush(file);