Skip to content

Commit

Permalink
Add version back to log files (#426)
Browse files Browse the repository at this point in the history
  • Loading branch information
BCook98 authored Jul 3, 2023
1 parent a4201b0 commit bd5824b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pkg/logger/logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"path/filepath"
"time"

"github.com/SafetyCulture/safetyculture-exporter/internal/app/version"
"github.com/SafetyCulture/safetyculture-exporter/pkg/internal/diagnostics"
"github.com/pkg/errors"
"go.uber.org/zap"
Expand Down Expand Up @@ -105,14 +106,15 @@ func getLogger(cores ...zapcore.Core) *zap.SugaredLogger {
)

// From a zapcore.Core, it's easy to construct a Logger.
l := zap.New(core).Named("safetyculture-exporter")
l := zap.New(core).Named(version.GetIntegrationID())
defer l.Sync()

// redirects output from the standard library's package-global logger to the supplied logger
zap.RedirectStdLog(l)

slg := l.Sugar().
With(
"version", version.GetVersion(),
"pid", os.Getpid(),
"uid", os.Getuid(),
)
Expand Down

0 comments on commit bd5824b

Please sign in to comment.