Navigation


Changeset 688:8c3dc8584dab in freeDiameter for libfdproto/messages.c


Ignore:
Timestamp:
Jan 19, 2011, 7:05:30 PM (13 years ago)
Author:
Sebastien Decugis <sdecugis@nict.go.jp>
Branch:
default
Phase:
public
Message:

Prepared capability for messages logging to separate files / folders

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libfdproto/messages.c

    r687 r688  
    793793
    794794/* Dump a message to a specified file stream */
    795 static void fd_msg_dump_fstr ( struct msg * msg, FILE * fstr )
     795void fd_msg_dump_fstr ( struct msg * msg, FILE * fstr )
    796796{
    797797        msg_or_avp * ref = msg;
     
    22632263                        *action = DISP_ACT_ERROR;
    22642264                } else {
    2265                         TRACE_DEBUG(INFO, "Received an answer to a local query with an unsupported application %d, discarding...",  (*msg)->msg_public.msg_appl);
    2266                         fd_msg_dump_walk(INFO, *msg);
     2265                        fd_msg_log( FD_MSG_LOG_DROPPED, *msg, "Internal error: Received this answer to a local query with an unsupported application %d", (*msg)->msg_public.msg_appl);
    22672266                        fd_msg_free(*msg);
    22682267                        *msg = NULL;
     
    23372336        pthread_mutex_t lock;
    23382337        int             init;
     2338        struct dictionary *dict;       
    23392339} ml_conf = { .lock = PTHREAD_MUTEX_INITIALIZER, .init = 0 };
    23402340
    2341 static void ml_conf_init(void)
     2341void ml_conf_init(struct dictionary *dict)
    23422342{
    23432343        memset(&ml_conf.causes, 0, sizeof(ml_conf.causes));
    23442344        ml_conf.init = 1;
     2345        ml_conf.dict = dict;
    23452346}
    23462347
     
    23572358        CHECK_POSIX( pthread_mutex_lock(&ml_conf.lock) );
    23582359        if (!ml_conf.init) {
    2359                 ml_conf_init();
     2360                ASSERT(0);
    23602361        }
    23612362       
     
    24062407        CHECK_POSIX_DO( pthread_mutex_lock(&ml_conf.lock), );
    24072408        if (!ml_conf.init) {
    2408                 ml_conf_init();
     2409                ASSERT(0);
    24092410        }
    24102411        meth    = ml_conf.causes[cause].meth;
     
    24202421                case FD_MSG_LOGTO_FILE:
    24212422                        TODO("Log to arg file");
     2423                        TODO("Log a note to debug stream");
    24222424                        break;
    24232425                case FD_MSG_LOGTO_DIR:
    24242426                        TODO("Log to arg directory in a new file");
    2425                         break;
    2426         }
    2427        
    2428         /* Then dump the prefix message to this stream */
     2427                        TODO("Log a note to debug stream");
     2428                        break;
     2429        }
     2430       
     2431        /* For file methods, let's parse the message so it looks better */
     2432        if ((meth != FD_MSG_LOGTO_DEBUGONLY) && ml_conf.dict) {
     2433                CHECK_FCT_DO( fd_msg_parse_dict( msg, ml_conf.dict, NULL ), );
     2434        }
     2435       
     2436        /* Then dump the prefix message to this stream, & to debug stream */
    24292437        (void)pthread_mutex_lock(&fd_log_lock);
    24302438        pthread_cleanup_push(fd_cleanup_mutex_silent, &fd_log_lock);
Note: See TracChangeset for help on using the changeset viewer.