all repos — honk @ e7b725fabdc66d45df72fe053e0dbcef55aa2c27

my fork of honk

fix logging for backend
Ted Unangst tedu@tedunangst.com
Wed, 09 Feb 2022 16:30:58 -0500
commit

e7b725fabdc66d45df72fe053e0dbcef55aa2c27

parent

aec7a0851ef9ed273809e7a1778aa6e84de35e3e

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

jump to
M backend.gobackend.go

@@ -104,7 +104,7 @@ srv.Accept(lis)

} func runBackendServer() { - proc := exec.Command(os.Args[0], "-datadir", dataDir, "backend") + proc := exec.Command(os.Args[0], reexecArgs("backend")...) proc.Stdout = os.Stdout proc.Stderr = os.Stderr err := proc.Start()
M honk.gohonk.go

@@ -259,6 +259,13 @@ db.Exec("delete from honkers where xid like ? and flavor = 'dub'", xid)

db.Exec("delete from doovers where rcpt like ?", xid) } +func reexecArgs(cmd string) []string { + args := []string{"-datadir", dataDir} + args = append(args, loggingArgs()...) + args = append(args, cmd) + return args +} + func main() { flag.StringVar(&dataDir, "datadir", dataDir, "data directory") flag.StringVar(&viewDir, "viewdir", viewDir, "view directory")
M log.golog.go

@@ -42,6 +42,10 @@ flag.StringVar(&alllogname, "log", "stderr", "combined log file (or stderr, null, syslog)")

} +func loggingArgs() []string { + return []string{"-errorlog", elogname, "-infolog", ilogname, "-debuglog", dlogname} +} + func initLogging(elogname, ilogname, dlogname string) { elog = openlog(elogname, syslog.LOG_ERR) ilog = openlog(ilogname, syslog.LOG_INFO)