Changeset 710:e60376cb15e8 in freeDiameter for libfdproto/msg_log.c
- Timestamp:
- Feb 10, 2011, 4:00:53 PM (13 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libfdproto/msg_log.c
r689 r710 109 109 FILE * fstr; 110 110 111 char buftime[256]; 112 size_t offset = 0; 113 struct timespec ts; 114 struct tm tm; 115 111 116 TRACE_ENTRY("%d %p %p", cause, msg, prefix_format); 112 117 CHECK_PARAMS_DO( (cause >= 0) && (cause <= FD_MSG_LOG_MAX), … … 125 130 CHECK_POSIX_DO( pthread_mutex_unlock(&ml_conf.lock), ); 126 131 132 /* Get current time */ 133 CHECK_SYS_DO( clock_gettime(CLOCK_REALTIME, &ts), /* continue */); 134 offset += strftime(buftime + offset, sizeof(buftime) - offset, "%D,%T", localtime_r( &ts.tv_sec , &tm )); 135 offset += snprintf(buftime + offset, sizeof(buftime) - offset, ".%6.6ld", ts.tv_nsec / 1000); 136 137 127 138 /* Okay, now we will create the file descriptor */ 128 139 switch (meth) { … … 142 153 143 154 /* For file methods, let's parse the message so it looks better */ 144 if (( meth != FD_MSG_LOGTO_DEBUGONLY) && ml_conf.dict) {155 if (((meth != FD_MSG_LOGTO_DEBUGONLY) || (fd_g_debug_lvl > FULL)) && ml_conf.dict) { 145 156 CHECK_FCT_DO( fd_msg_parse_dict( msg, ml_conf.dict, NULL ), ); 146 157 } … … 155 166 pthread_cleanup_pop(0); 156 167 (void)pthread_mutex_unlock(&fd_log_lock); 157 fd_log_debug_fstr(fstr, "\n\n"); 168 169 fd_log_debug_fstr(fstr, "\nLogged: %s\n\n", buftime); 158 170 159 171 /* And now the message itself */ 160 fd_msg_dump_fstr(msg, fstr); 172 if ((meth == FD_MSG_LOGTO_DEBUGONLY) && (fd_g_debug_lvl <= INFO)) { 173 /* dump only the header */ 174 fd_msg_dump_fstr_one(msg, fstr); 175 } else { 176 /* dump the full content */ 177 fd_msg_dump_fstr(msg, fstr); 178 } 161 179 162 180 /* And finally close the stream if needed */ 163 TODO("close?"); 181 switch (meth) { 182 case FD_MSG_LOGTO_DEBUGONLY: 183 break; 184 185 case FD_MSG_LOGTO_FILE: 186 TODO("close?"); 187 break; 188 case FD_MSG_LOGTO_DIR: 189 TODO("close?"); 190 break; 191 } 164 192 } 165 193
Note: See TracChangeset
for help on using the changeset viewer.