Navigation


Changeset 945:284608b307ee in freeDiameter for libfdproto


Ignore:
Timestamp:
Feb 12, 2013, 7:56:53 PM (11 years ago)
Author:
Thomas Klausner <tk@giga.or.at>
Branch:
default
Phase:
public
Message:

Add timestamp to default logger.
Only add newline if there is none.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libfdproto/log.c

    r941 r945  
    8989static void fd_internal_logger( int loglevel, const char *format, va_list ap )
    9090{
     91    char buf[25];
    9192    FILE *fstr = fd_g_debug_fstr ?: stdout;
    9293
    9394    /* logging has been decided by macros outside already */
    94     vfprintf( fd_g_debug_fstr, format, ap);
    95     fprintf(fd_g_debug_fstr, "\n");
     95
     96    /* add timestamp */
     97    fprintf(fd_g_debug_fstr, "%s\t", fd_log_time(NULL, buf, sizeof(buf)));
     98    vfprintf(fd_g_debug_fstr, format, ap);
     99    if (format && (format[strlen(format)-1] != '\n')) {
     100        fprintf(fd_g_debug_fstr, "\n");
     101    }
    96102    fflush(fd_g_debug_fstr);
    97103}
Note: See TracChangeset for help on using the changeset viewer.