Skip to content

Commit

Permalink
not export logging stdout / stderr hook
Browse files Browse the repository at this point in the history
  • Loading branch information
genofire committed Feb 27, 2019
1 parent 3ef2d1e commit e553685
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
9 changes: 9 additions & 0 deletions cmd/serve.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,22 @@ import (
"github.com/bdlm/log"
"github.com/spf13/cobra"

"github.com/FreifunkBremen/yanic/database"
allDatabase "github.com/FreifunkBremen/yanic/database/all"
allOutput "github.com/FreifunkBremen/yanic/output/all"
"github.com/FreifunkBremen/yanic/respond"
"github.com/FreifunkBremen/yanic/runtime"
"github.com/FreifunkBremen/yanic/webserver"
)

// ServeConfig represents the whole configuration
type ServeConfig struct {
Respondd respond.Config
Webserver webserver.Config
Nodes runtime.NodesConfig
Database database.Config
}

// serveCmd represents the serve command
var serveCmd = &cobra.Command{
Use: "serve",
Expand Down
8 changes: 4 additions & 4 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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()
}

0 comments on commit e553685

Please sign in to comment.