not export logging stdout / stderr hook

This commit is contained in:
Martin/Geno 2019-02-27 02:51:01 +01:00
parent 3ef2d1ece9
commit 94267cf6dd
No known key found for this signature in database
GPG Key ID: 9D7D3C6BFF600C6A

View File

@ -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()
}