We call spin_log() in main() (while processing the command line arguments). spin_log_init() is called afterwards. This means that we potentially call spin_log() while the log has not been initialized yet. In particular, this means that log messages generated while processing the command line arguments do not appear on stdout even if we specify -o (but go to syslog instead).
Should we just use printf() while processing the command line arguments? We could also print the messages we want to print after we initialized the log. A pseudodiff follows to illustrate what I mean:
while ((c = getopt (argc, argv, "dehLlm:op:v")) != -1) {
switch (c) {
case 'l':
- spin_log(LOG_INFO, "Running in local mode; traffic without either entry in arp cache will be shown too\n");
local_mode = 1;
break;
}
}
spin_log_init(use_syslog, log_verbosity, "spind");
+
+if (local_mode) {
+ spin_log(LOG_INFO, "Running in local mode; traffic without either entry in arp cache will be shown too\n");
+}
We call
spin_log()
inmain()
(while processing the command line arguments).spin_log_init()
is called afterwards. This means that we potentially callspin_log()
while the log has not been initialized yet. In particular, this means that log messages generated while processing the command line arguments do not appear on stdout even if we specify-o
(but go to syslog instead).Should we just use
printf()
while processing the command line arguments? We could also print the messages we want to print after we initialized the log. A pseudodiff follows to illustrate what I mean: