diff options
author | Martin Mares <mj@ucw.cz> | 1999-12-06 13:45:56 +0000 |
---|---|---|
committer | Martin Mares <mj@ucw.cz> | 1999-12-06 13:45:56 +0000 |
commit | a0c37b45e59f024fc24b65ffbaf2c9e0f1996938 (patch) | |
tree | b20a91de7de7349266e4eb708c839f8ceb9d7a77 /sysdep/unix/main.c | |
parent | 7c0cc76ed76100ef8492f13eeec1e061d52b9be0 (diff) |
Logging is now configurable. You can define multiple log outputs (to both
files and syslog) and assign lists of message categories to each of them.
Diffstat (limited to 'sysdep/unix/main.c')
-rw-r--r-- | sysdep/unix/main.c | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/sysdep/unix/main.c b/sysdep/unix/main.c index d5ea10bd..8e2678a2 100644 --- a/sysdep/unix/main.c +++ b/sysdep/unix/main.c @@ -67,6 +67,18 @@ cf_read(byte *dest, unsigned int len) return l; } +void +sysdep_preconfig(struct config *c) +{ + init_list(&c->logfiles); +} + +void +sysdep_commit(struct config *c) +{ + log_switch(&c->logfiles); +} + static void read_config(void) { @@ -258,12 +270,13 @@ signal_init(void) * Parsing of command-line arguments */ -static char *opt_list = "c:d:"; +static char *opt_list = "c:dD:"; +static int debug_flag = 1; /* FIXME: Turn off for production use */ static void usage(void) { - fprintf(stderr, "Usage: bird [-c <config-file>] [-d <debug-file>]\n"); + fprintf(stderr, "Usage: bird [-c <config-file>] [-d] [-D <debug-file>]\n"); exit(1); } @@ -279,7 +292,11 @@ parse_args(int argc, char **argv) config_name = optarg; break; case 'd': + debug_flag |= 1; + break; + case 'D': log_init_debug(optarg); + debug_flag |= 2; break; default: usage(); @@ -300,10 +317,12 @@ main(int argc, char **argv) dmalloc_debug(0x2f03d00); #endif - log_init_debug(NULL); setvbuf(stdout, NULL, _IONBF, 0); /* FIXME: Kill some day. */ setvbuf(stderr, NULL, _IONBF, 0); parse_args(argc, argv); + if (debug_flag == 1) + log_init_debug(""); + log_init(debug_flag); log(L_INFO "Launching BIRD " BIRD_VERSION "..."); |