forked from Mirrors/bubbletea
Remove syslog stuff for Windows support + LogToFile()'s a better choice.
This commit is contained in:
parent
5d434e1753
commit
c6a1afd3c7
17
logging.go
17
logging.go
|
@ -1,10 +1,7 @@
|
||||||
// +build darwin dragonfly freebsd linux netbsd openbsd solaris
|
|
||||||
|
|
||||||
package tea
|
package tea
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"log"
|
"log"
|
||||||
"log/syslog"
|
|
||||||
"os"
|
"os"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -28,17 +25,3 @@ func LogToFile(path string, prefix string) (*os.File, error) {
|
||||||
log.SetOutput(f)
|
log.SetOutput(f)
|
||||||
return f, nil
|
return f, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// UseSysLog sets up logging to log the system log. This becomes helpful when
|
|
||||||
// debugging since we can't print to the terminal since our TUI is occupying it.
|
|
||||||
//
|
|
||||||
// On macOS this is a just a matter of: tail -f /var/log/system.log
|
|
||||||
// On Linux this varies depending on distribution.
|
|
||||||
func UseSysLog(programName string) error {
|
|
||||||
l, err := syslog.New(syslog.LOG_NOTICE, programName)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
log.SetOutput(l)
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in New Issue