diff options
-rw-r--r-- | src/ck-debug.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/ck-debug.c b/src/ck-debug.c index 458b467..adf17d5 100644 --- a/src/ck-debug.c +++ b/src/ck-debug.c @@ -48,16 +48,17 @@ ck_debug_real (const char *func, const char *format, ...) { va_list args; - char buffer [1025]; + char buffer [256]; char *str_time; time_t the_time; + FILE *stream; if (debugging == FALSE) return; va_start (args, format); - g_vsnprintf (buffer, 1024, format, args); + g_vsnprintf (buffer, 255, format, args); va_end (args); @@ -65,13 +66,12 @@ ck_debug_real (const char *func, str_time = g_new0 (char, 255); strftime (str_time, 254, "%H:%M:%S", localtime (&the_time)); - fprintf ((debug_out ? debug_out : stderr), + stream = debug_out ? debug_out : stderr; + setbuf (stream, NULL); + fprintf (stream, "[%s] %s:%d (%s):\t %s\n", func, file, line, str_time, buffer); - if (debug_out) - fflush (debug_out); - g_free (str_time); } |