Skip to content
Myr

syslog is only available on unix systems

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Christian Muehlhaeuser · committed by Christian Muehlhaeuser · parent bc67e38 · Browse files · 2 files+23 added−16 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+23 added−16 removed

  • other:+23 added−16 removed

2 files+23 added−16 removed

added:logging.go+22 added
1// +build darwin dragonfly freebsd linux netbsd openbsd solaris23package tea45import (6 "log"7 "log/syslog"8)910// UseSysLog sets up logging to log the system log. This becomes helpful when11// debugging since we can't easily print to the terminal since our TUI is12// occupying it!13//14// On macOS this is a just a matter of: tail -f /var/log/system.log15func UseSysLog(programName string) error {16 l, err := syslog.New(syslog.LOG_NOTICE, programName)17 if err != nil {18 return err19 }20 log.SetOutput(l)21 return nil22}
modified:tea.go+1 added-16 removed
1 unmodified line
23import (4 "errors"5 "io"6 "log"7 "log/syslog"6 "os"7 "strings"8)910// Msg represents an action. It's used by Update to update the UI.
163 unmodified lines
174 }175 io.WriteString(os.Stdout, view)176 return strings.Count(view, "\r\n")177}179180// UseSysLog sets up logging to log the system log. This becomes helpful when181// debugging since we can't easily print to the terminal since our TUI is182// occupying it!183//184// On macOS this is a just a matter of: tail -f /var/log/system.log185func UseSysLog(programName string) error {186 l, err := syslog.New(syslog.LOG_NOTICE, programName)187 if err != nil {188 return err189 }190 log.SetOutput(l)191 return nil192}