summaryrefslogtreecommitdiff
path: root/sysdep/unix/config.Y
diff options
context:
space:
mode:
authorMartin Mares <mj@ucw.cz>1999-12-06 13:45:56 +0000
committerMartin Mares <mj@ucw.cz>1999-12-06 13:45:56 +0000
commita0c37b45e59f024fc24b65ffbaf2c9e0f1996938 (patch)
treeb20a91de7de7349266e4eb708c839f8ceb9d7a77 /sysdep/unix/config.Y
parent7c0cc76ed76100ef8492f13eeec1e061d52b9be0 (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/config.Y')
-rw-r--r--sysdep/unix/config.Y62
1 files changed, 62 insertions, 0 deletions
diff --git a/sysdep/unix/config.Y b/sysdep/unix/config.Y
new file mode 100644
index 00000000..bd9c3822
--- /dev/null
+++ b/sysdep/unix/config.Y
@@ -0,0 +1,62 @@
+/*
+ * BIRD -- UNIX Configuration
+ *
+ * (c) 1999 Martin Mares <mj@ucw.cz>
+ *
+ * Can be freely distributed and used under the terms of the GNU GPL.
+ */
+
+CF_HDR
+
+#include "lib/unix.h"
+
+CF_DECLS
+
+CF_KEYWORDS(LOG, SYSLOG, ALL, DEBUG, TRACE, INFO, REMOTE, WARNING, ERROR, AUTH, FATAL, BUG)
+
+%type <i> log_mask log_mask_list log_cat
+
+CF_GRAMMAR
+
+CF_ADDTO(conf, log_config)
+
+log_config: LOG TEXT log_mask ';' {
+ struct log_config *c = cfg_allocz(sizeof(struct log_config));
+ FILE *f = rfopen(new_config->pool, $2, "a");
+ if (!f) cf_error("Unable to open log file `%s': %m", $2);
+ c->mask = $3;
+ c->fh = f;
+ add_tail(&new_config->logfiles, &c->n);
+ }
+ | LOG SYSLOG log_mask ';' {
+ struct log_config *c = cfg_allocz(sizeof(struct log_config));
+ c->mask = $3;
+ add_tail(&new_config->logfiles, &c->n);
+ }
+ ;
+
+log_mask:
+ ALL { $$ = ~0; }
+ | '{' log_mask_list '}' { $$ = $2; }
+ ;
+
+log_mask_list:
+ log_cat { $$ = 1 << $1; }
+ | log_mask_list ',' log_cat { $$ = $1 | (1 << $3); }
+ ;
+
+log_cat:
+ DEBUG { $$ = L_DEBUG[0]; }
+ | TRACE { $$ = L_TRACE[0]; }
+ | INFO { $$ = L_INFO[0]; }
+ | REMOTE { $$ = L_REMOTE[0]; }
+ | WARNING { $$ = L_WARN[0]; }
+ | ERROR { $$ = L_ERR[0]; }
+ | AUTH { $$ = L_AUTH[0]; }
+ | FATAL { $$ = L_FATAL[0]; }
+ | BUG { $$ = L_BUG[0]; }
+ ;
+
+CF_CODE
+
+CF_END