all repos — honk @ 4124f790bbcde57cc9b17f2899b14f1e2446563d

my fork of honk

allow stdout logging
Ted Unangst tedu@tedunangst.com
Sun, 06 Feb 2022 00:45:54 -0500
commit

4124f790bbcde57cc9b17f2899b14f1e2446563d

parent

c14bc81fa40b39805520b55fc8317f4465c483d2

1 files changed, 6 insertions(+), 3 deletions(-)

jump to
M log.golog.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 {

@@ -54,9 +60,6 @@ elog.Printf("can't create syslog: %s", err)

return log.Default() } 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 {