Browse Source

not export logging stdout / stderr hook

respondd-crashed
Martin/Geno 2 years ago
parent
commit
94267cf6dd
No known key found for this signature in database GPG Key ID: 9D7D3C6BFF600C6A
  1. 8
      main.go

8
main.go

@ -9,9 +9,9 @@ import (
"github.com/FreifunkBremen/yanic/cmd"
)
type Hook struct{}
type hook struct{}
func (hook *Hook) Fire(entry *log.Entry) error {
func (h *hook) Fire(entry *log.Entry) error {
switch entry.Level {
case log.PanicLevel:
entry.Logger.Out = os.Stderr
@ -31,12 +31,12 @@ func (hook *Hook) Fire(entry *log.Entry) error {
return nil
}
func (hook *Hook) Levels() []stdLogger.Level {
func (h *hook) Levels() []stdLogger.Level {
return log.AllLevels
}
func main() {
log.AddHook(&Hook{})
log.AddHook(&hook{})
cmd.Execute()
}
Loading…
Cancel
Save