not export logging stdout / stderr hook
This commit is contained in:
parent
3ef2d1ece9
commit
94267cf6dd
8
main.go
8
main.go
@ -9,9 +9,9 @@ import (
|
|||||||
"github.com/FreifunkBremen/yanic/cmd"
|
"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 {
|
switch entry.Level {
|
||||||
case log.PanicLevel:
|
case log.PanicLevel:
|
||||||
entry.Logger.Out = os.Stderr
|
entry.Logger.Out = os.Stderr
|
||||||
@ -31,12 +31,12 @@ func (hook *Hook) Fire(entry *log.Entry) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (hook *Hook) Levels() []stdLogger.Level {
|
func (h *hook) Levels() []stdLogger.Level {
|
||||||
return log.AllLevels
|
return log.AllLevels
|
||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
log.AddHook(&Hook{})
|
log.AddHook(&hook{})
|
||||||
|
|
||||||
cmd.Execute()
|
cmd.Execute()
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user