Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions common/logging.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package common

import (
"os"

"github.com/rs/zerolog"
"github.com/rs/zerolog/log"
)

// SetupLogging configures zerolog to output in string format instead of JSON.
func SetupLogging() {
log.Logger = log.Output(zerolog.ConsoleWriter{
Out: os.Stderr,
TimeFormat: zerolog.TimeFieldFormat,
PartsOrder: []string{
zerolog.TimestampFieldName,
zerolog.LevelFieldName,
zerolog.CallerFieldName,
zerolog.MessageFieldName,
},
})
}
2 changes: 2 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@ import (

"github.com/rs/zerolog/log"
"github.com/shutter-network/observer/cmd/cli"
"github.com/shutter-network/observer/common"
)

func main() {
common.SetupLogging()
status := 0
if err := cli.Cmd().Execute(); err != nil {
log.Info().Err(err).Msg("failed running server")
Expand Down