# # Escape sequences for current date and time as described in strftime(3) can be used.
# FileName log/test-%Y%m%d
#
+# # If you need to log to stderr or another already opened descriptor, you can specify its number.
+# FileDesc 2
+#
# # Instead of a file, a syslog facility can be specified. See syslog(3) for an explanation.
# SyslogFacility daemon
#
cnode n;
char *name;
char *file_name;
+ int file_desc;
char *syslog_facility;
u32 levels;
clist types; // simple_list of names
struct stream_config *c = ptr;
c->levels = ~0U;
+ c->file_desc = -1;
return NULL;
}
#define P(x) PTR_TO(struct stream_config, x)
CF_STRING("Name", P(name)),
CF_STRING("FileName", P(file_name)),
+ CF_INT("FileDesc", P(file_desc)),
CF_STRING("SyslogFacility", P(syslog_facility)),
CF_BITMAP_LOOKUP("Levels", P(levels), level_names),
CF_LIST("Types", P(types), &cf_string_list_config),
if (c->file_name)
ls = log_new_file(c->file_name, (c->stderr_follows ? FF_FD2_FOLLOWS : 0));
+ else if (c->file_desc >= 0)
+ ls = log_new_fd(c->file_desc, (c->stderr_follows ? FF_FD2_FOLLOWS : 0));
else if (c->syslog_facility)
ls = log_new_syslog(c->syslog_facility, (c->syslog_pids ? LOG_PID : 0));
else