Navigation


Changeset 1243:7c5f662c4eef in freeDiameter for libfdproto


Ignore:
Timestamp:
Nov 11, 2013, 3:55:10 PM (10 years ago)
Author:
Sebastien Decugis <sdecugis@freediameter.net>
Branch:
default
Phase:
public
Message:

Shortened log timestamp format when DEBUG_WITHOUT_META is defined

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libfdproto/log.c

    r1119 r1243  
    9595
    9696    /* add timestamp */
    97     printf("%s  ", fd_log_time(NULL, buf, sizeof(buf)));
    98    
     97    printf("%s  ", fd_log_time(NULL, buf, sizeof(buf),
     98#if (defined(DEBUG) && !defined(DEBUG_WITHOUT_META))
     99        1, 1
     100#else /* (defined(DEBUG) && !defined(DEBUG_WITHOUT_META)) */
     101        0, 0
     102#endif /* (defined(DEBUG) && !defined(DEBUG_WITHOUT_META)) */
     103            ));
    99104    /* Use colors on stdout ? */
    100105    if (!use_colors) {
     
    184189
    185190/* Write time into a buffer */
    186 char * fd_log_time ( struct timespec * ts, char * buf, size_t len )
     191char * fd_log_time ( struct timespec * ts, char * buf, size_t len, int incl_date, int incl_ms )
    187192{
    188193        int ret;
     
    201206        }
    202207       
    203         offset += strftime(buf + offset, len - offset, "%D,%T", localtime_r( &ts->tv_sec , &tm ));
    204         offset += snprintf(buf + offset, len - offset, ".%6.6ld", ts->tv_nsec / 1000);
     208        offset += strftime(buf + offset, len - offset, incl_date?"%D,%T":"%T", localtime_r( &ts->tv_sec , &tm ));
     209        if (incl_ms)
     210                offset += snprintf(buf + offset, len - offset, ".%6.6ld", ts->tv_nsec / 1000);
    205211
    206212        return buf;
Note: See TracChangeset for help on using the changeset viewer.