chiark / gitweb /
Closures: Provide closure_type_name
[secnet.git] / log.c
diff --git a/log.c b/log.c
index f937d2ec35d4500294d568d43da2e4258ed3512e..dd3e4776c4517d79cc84b14615379f7ffd56b6ea 100644 (file)
--- a/log.c
+++ b/log.c
@@ -162,6 +162,13 @@ void cfgfatal_maybefile(FILE *maybe_f, struct cloc loc, cstring_t facility,
     va_end(args);
 }    
 
+void cfgfatal_cl_type(struct cloc loc, const char *facility,
+                     closure_t *cl, uint32_t exp_type, const char *name)
+{
+    assert(cl->type != exp_type);
+    cfgfatal(loc,facility,"\"%s\" is the wrong type of closure\n",name);
+}
+
 void cfgfatal(struct cloc loc, cstring_t facility, const char *message, ...)
 {
     va_list args;
@@ -659,9 +666,14 @@ void log_from_fd(int fd, cstring_t prefix, struct log_if *log)
 }
 
 static struct logfile startup_log;
+void log_early_setlevel(void)
+{
+    startup_log.level=message_level;
+}
 void log_early_init(void)
 {
     logfile_file_init(&startup_log,stderr,"startup");
+    log_early_setlevel();
     system_log=&startup_log.ops;;
 }