allow stdout logging
This commit is contained in:
parent
7eef6ae5d0
commit
7a3bf5bffb
9
log.go
9
log.go
|
@ -47,6 +47,12 @@ func openlog(name string, prio syslog.Priority) *log.Logger {
|
|||
if name == "stderr" {
|
||||
return log.Default()
|
||||
}
|
||||
if name == "stdout" {
|
||||
return log.New(os.Stdout, os.Args[0], log.LstdFlags)
|
||||
}
|
||||
if name == "null" {
|
||||
return log.New(ioutil.Discard, os.Args[0], log.LstdFlags)
|
||||
}
|
||||
if name == "syslog" {
|
||||
logger, err := syslog.NewLogger(syslog.LOG_UUCP|prio, 0)
|
||||
if err != nil {
|
||||
|
@ -55,9 +61,6 @@ func openlog(name string, prio syslog.Priority) *log.Logger {
|
|||
}
|
||||
return logger
|
||||
}
|
||||
if name == "null" {
|
||||
return log.New(ioutil.Discard, os.Args[0], log.LstdFlags)
|
||||
}
|
||||
fd, err := os.OpenFile(name, os.O_WRONLY|os.O_CREATE|os.O_APPEND, 0600)
|
||||
if err != nil {
|
||||
elog.Printf("can't open log file %s: %s", name, err)
|
||||
|
|
Loading…
Reference in New Issue