syslog (closure => log closure)
logfile: dict argument
- filename (string): where to log to
+ filename (string): where to log to; default is stderr
class (string list): what type of messages to log
{ "debug-config", M_DEBUG_CONFIG },
{ "debug-phase", M_DEBUG_PHASE },
{
struct logfile *st=sst;
FILE *f;
+ if (!st->logfile) return;
f=fopen(st->logfile,"a");
if (!f) {
logfile_log(st,M_FATAL,"received SIGHUP, but could not reopen "
struct logfile *st=sst;
FILE *f;
- if (background) {
+ if (background && st->logfile) {
f=fopen(st->logfile,"a");
if (!f) fatal_perror("logfile (%s:%d): cannot open \"%s\"",
st->loc.file,st->loc.line,st->logfile);
st->ops.vlogfn=logfile_vlog;
st->ops.buff[0]=0;
st->loc=loc;
- st->f=NULL;
+ st->f=stderr;
st->forked=0;
item=list_elem(args,0);
}
dict=item->data.dict;
- st->logfile=dict_read_string(dict,"filename",True,"logfile",loc);
+ st->logfile=dict_read_string(dict,"filename",False,"logfile",loc);
st->level=string_list_to_word(dict_lookup(dict,"class"),
message_class_table,"logfile");