]> mj.ucw.cz Git - libucw.git/commitdiff
Logging: Fatality of logging errors is configurable.
authorMartin Mares <mj@ucw.cz>
Thu, 19 Feb 2009 17:55:08 +0000 (18:55 +0100)
committerMartin Mares <mj@ucw.cz>
Thu, 19 Feb 2009 17:55:08 +0000 (18:55 +0100)
cf/libucw
ucw/log-conf.c

index a6f19919b2ddc82a6b6e127f430fa41a676d5a79..effeb25a2fdfba14c75663922ec2265fe47ce5e2 100644 (file)
--- a/cf/libucw
+++ b/cf/libucw
@@ -187,6 +187,7 @@ Stream {
        FileName        log/test2
        Microseconds    1
        Levels:reset    warn error
+       ErrorsFatal     1
 }
 
 Stream {
index 6a92c20e157ecaabe6c00c36ab745b9266ff85ff..bea6ad0c1d4ccb0f2ef7095f1f3ac6050a1b5ff5 100644 (file)
@@ -24,6 +24,7 @@ struct stream_config {
   clist substreams;                    // simple_list of names
   int microseconds;                    // Enable logging of precise timestamps
   int syslog_pids;
+  int errors_fatal;
   struct log_stream *ls;
   int mark;                            // Used temporarily in log_config_commit()
 };
@@ -71,6 +72,7 @@ static struct cf_section stream_config = {
     CF_LIST("Substream", P(substreams), &cf_string_list_config),
     CF_INT("Microseconds", P(microseconds)),
     CF_INT("SyslogPID", P(syslog_pids)),
+    CF_INT("ErrorsFatal", P(errors_fatal)),
 #undef P
     CF_END
   }
@@ -171,6 +173,8 @@ do_new_configured(struct stream_config *c)
   ls->levels = c->levels;
   if (c->microseconds)
     ls->msgfmt |= LSFMT_USEC;
+  if (c->errors_fatal)
+    ls->stream_flags |= LSFLAG_ERR_IS_FATAL;
 
   c->ls = ls;
   return ls;