Skip to content

Commit

Permalink
feat: add seconds and milliseconds to log output
Browse files Browse the repository at this point in the history
  • Loading branch information
ReuDa committed Jul 13, 2023
1 parent d9034ec commit 5b08ac7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 1.8.1

- add seconds and milliseconds to log output

## 1.8.0

- add support for listening on unix domain sockets instead of TCP ports
Expand Down
5 changes: 3 additions & 2 deletions extlogging/extlogging.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,13 @@ import (
"github.com/rs/zerolog/log"
"os"
"strings"
"time"
)

// InitZeroLog configures the zerolog logging output in a standardized way. More specifically, it configures the output to be sent to stderr,
// a human-readable output format, the time format and the global log level.
func InitZeroLog() {
zerolog.TimeFieldFormat = zerolog.TimeFormatUnix
zerolog.TimeFieldFormat = zerolog.TimeFormatUnixMs

noColor := false
logColor := os.Getenv("STEADYBIT_LOG_COLOR")
Expand All @@ -31,7 +32,7 @@ func InitZeroLog() {

logFormat := os.Getenv("STEADYBIT_LOG_FORMAT")
if strings.ToLower(logFormat) != "json" {
log.Logger = log.Output(zerolog.ConsoleWriter{Out: os.Stderr, NoColor: noColor})
log.Logger = log.Output(zerolog.ConsoleWriter{Out: os.Stderr, NoColor: noColor, TimeFormat: time.DateTime + ".000"})
}

logLevel := os.Getenv("STEADYBIT_LOG_LEVEL")
Expand Down

0 comments on commit 5b08ac7

Please sign in to comment.