Navigation


Changeset 898:c2ecce3fb928 in freeDiameter


Ignore:
Timestamp:
Dec 4, 2012, 5:27:19 AM (11 years ago)
Author:
Sebastien Decugis <sdecugis@freediameter.net>
Branch:
default
Phase:
public
Message:

Add a NONE option for fd_msg_log to disable the trace

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • include/freeDiameter/libfdproto.h

    r897 r898  
    22472247/* configure the msg_log facility */
    22482248enum fd_msg_log_method {
    2249         FD_MSG_LOGTO_DEBUGONLY = 0, /* Simply log the message with other debug information, at the INFO level. This is default */
     2249        FD_MSG_LOGTO_NONE = 0, /* The message is not dumped. This is the default. */
     2250        FD_MSG_LOGTO_DEBUGONLY, /* Simply log the message with other debug information, at the INFO level. */
    22502251        FD_MSG_LOGTO_FILE,    /* Messages are dumped in a single file, defined in arg */
    22512252        FD_MSG_LOGTO_DIR    /* Messages are dumped in different files within one directory defined in arg. */
  • libfdproto/msg_log.c

    r895 r898  
    6464        TRACE_ENTRY("%d %d %p", cause, method, arg);
    6565        CHECK_PARAMS( (cause >= 0) && (cause <= FD_MSG_LOG_MAX) );
    66         CHECK_PARAMS( (method >= FD_MSG_LOGTO_DEBUGONLY) && (method <= FD_MSG_LOGTO_DIR) );
    67         CHECK_PARAMS( (method == FD_MSG_LOGTO_DEBUGONLY) || (arg != NULL) );
     66        CHECK_PARAMS( (method >= FD_MSG_LOGTO_NONE) && (method <= FD_MSG_LOGTO_DIR) );
     67        CHECK_PARAMS( (method == FD_MSG_LOGTO_NONE) || (method == FD_MSG_LOGTO_DEBUGONLY) || (arg != NULL) );
    6868       
    6969        /* Lock the configuration */
     
    8282                                (cause == FD_MSG_LOG_RECEIVED) ? "RECEIVED" :
    8383                                        (cause == FD_MSG_LOG_SENT) ? "SENT" :
     84                                        (cause == FD_MSG_LOG_NODELIVER) ? "NODELIVER" :
     85                                        (cause == FD_MSG_LOG_TIMING) ? "TIMING" :
    8486                                                "???",
    85                         (method == FD_MSG_LOGTO_FILE) ? "file" :
     87                        (method == FD_MSG_LOGTO_NONE) ? "none" :
     88                                (method == FD_MSG_LOGTO_DEBUGONLY) ? "debug" :
     89                                (method == FD_MSG_LOGTO_FILE) ? "file" :
    8690                                (method == FD_MSG_LOGTO_DIR) ? "directory" :
    8791                                        "???",
     
    130134        CHECK_POSIX_DO( pthread_mutex_unlock(&ml_conf.lock), );
    131135       
    132         /* Do not log if the level is not at least INFO */
    133         if ((meth == FD_MSG_LOGTO_DEBUGONLY) && (fd_g_debug_lvl < INFO)) {
     136        /* Return now when loging is not requested */
     137        if ((meth == FD_MSG_LOGTO_NONE)
     138         || ((meth == FD_MSG_LOGTO_DEBUGONLY) && (fd_g_debug_lvl < INFO))) {
    134139                return;
    135140        }
     
    187192        /* And finally close the stream if needed */
    188193        switch (meth) {
    189                 case FD_MSG_LOGTO_DEBUGONLY:
    190                         break;
    191                        
    192194                case FD_MSG_LOGTO_FILE:
    193195                        TODO("close?");
Note: See TracChangeset for help on using the changeset viewer.