Changeset 899:40d5e8002b12 in freeDiameter for freeDiameterd
- Timestamp:
- Dec 4, 2012, 5:53:16 AM (11 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
freeDiameterd/main.c
r740 r899 49 49 static char *conffile = NULL; 50 50 static int gnutls_debug = 0; 51 static int fd_msg_log_enabled = 0; /* all logs disabled by default, this field is a bitfield of enabled FD_MSG_LOG_* */ 51 52 52 53 /* gnutls debug */ … … 85 86 gnutls_global_set_log_level (gnutls_debug); 86 87 TRACE_DEBUG(INFO, "Enabled GNUTLS debug at level %d", gnutls_debug); 88 } 89 90 /* set messages logging */ 91 if (fd_msg_log_enabled) { 92 if (fd_msg_log_enabled & (1 << FD_MSG_LOG_DROPPED)) { 93 CHECK_FCT( fd_msg_log_config(FD_MSG_LOG_DROPPED, FD_MSG_LOGTO_DEBUGONLY, NULL) ); 94 } 95 if (fd_msg_log_enabled & (1 << FD_MSG_LOG_RECEIVED)) { 96 CHECK_FCT( fd_msg_log_config(FD_MSG_LOG_RECEIVED, FD_MSG_LOGTO_DEBUGONLY, NULL) ); 97 } 98 if (fd_msg_log_enabled & (1 << FD_MSG_LOG_SENT)) { 99 CHECK_FCT( fd_msg_log_config(FD_MSG_LOG_SENT, FD_MSG_LOGTO_DEBUGONLY, NULL) ); 100 } 101 if (fd_msg_log_enabled & (1 << FD_MSG_LOG_NODELIVER)) { 102 CHECK_FCT( fd_msg_log_config(FD_MSG_LOG_NODELIVER, FD_MSG_LOGTO_DEBUGONLY, NULL) ); 103 } 104 if (fd_msg_log_enabled & (1 << FD_MSG_LOG_TIMING)) { 105 CHECK_FCT( fd_msg_log_config(FD_MSG_LOG_TIMING, FD_MSG_LOGTO_DEBUGONLY, NULL) ); 106 } 87 107 } 88 108 … … 149 169 " -V, --version Print version and exit\n" 150 170 " -c, --config=filename Read configuration from this file instead of the \n" 151 " default location (" DEFAULT_CONF_PATH "/" FD_DEFAULT_CONF_FILENAME ").\n"); 171 " default location (" DEFAULT_CONF_PATH "/" FD_DEFAULT_CONF_FILENAME ").\n" 172 " -M, --enable_msg_log=( DROPPED | RECEIVED | SENT | NODELIVER | TIMING )\n" 173 " Disable logging of these messages in the output.\n"); 152 174 printf( "\nDebug:\n" 153 175 " These options are mostly useful for developers\n" … … 175 197 { "dbg_file", required_argument, NULL, 'F' }, 176 198 { "dbg_gnutls", required_argument, NULL, 'g' }, 199 { "enable_msg_log", optional_argument, NULL, 'M' }, 177 200 { NULL, 0, NULL, 0 } 178 201 }; … … 180 203 /* Loop on arguments */ 181 204 while (1) { 182 c = getopt_long (argc, argv, "hVc:dql: ", long_options, &option_index);205 c = getopt_long (argc, argv, "hVc:dql:M:", long_options, &option_index); 183 206 if (c == -1) 184 207 break; /* Exit from the loop. */ … … 208 231 } 209 232 break; 233 234 case 'M': /* disable logging of these messages */ 235 if (optarg) { 236 if (!strcmp(optarg, "DROPPED")) { 237 fd_msg_log_enabled |= 1 << FD_MSG_LOG_DROPPED; 238 } else 239 if (!strcmp(optarg, "RECEIVED")) { 240 fd_msg_log_enabled |= 1 << FD_MSG_LOG_RECEIVED; 241 } else 242 if (!strcmp(optarg, "SENT")) { 243 fd_msg_log_enabled |= 1 << FD_MSG_LOG_SENT; 244 } else 245 if (!strcmp(optarg, "NODELIVER")) { 246 fd_msg_log_enabled |= 1 << FD_MSG_LOG_NODELIVER; 247 } else 248 if (!strcmp(optarg, "TIMING")) { 249 fd_msg_log_enabled |= 1 << FD_MSG_LOG_TIMING; 250 } else { 251 main_help(); 252 exit(0); 253 } 254 } else { 255 fd_msg_log_enabled = -1; /* all logs enabled */ 256 } 210 257 211 258 case 'd': /* Increase verbosity of debug messages. */
Note: See TracChangeset
for help on using the changeset viewer.