Skip to content

Commit

Permalink
logging: Use RedirectStdLog to capture more stdlib logs (#4732)
Browse files Browse the repository at this point in the history
* logging: Use `RedirectStdLog`

* .gitignore a file pattern that I'm constantly using for testing
  • Loading branch information
francislavoie committed Apr 28, 2022
1 parent 2e4c091 commit 3017b24
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
@@ -1,6 +1,7 @@
_gitignore/
*.log
Caddyfile
Caddyfile.*
!caddyfile/

# artifacts from pprof tooling
Expand Down
8 changes: 7 additions & 1 deletion logging.go
Expand Up @@ -661,9 +661,15 @@ func newDefaultProductionLog() (*defaultCustomLog, error) {

cl.buildCore()

logger := zap.New(cl.core)

// capture logs from other libraries which
// may not be using zap logging directly
_ = zap.RedirectStdLog(logger)

return &defaultCustomLog{
CustomLog: cl,
logger: zap.New(cl.core),
logger: logger,
}, nil
}

Expand Down

0 comments on commit 3017b24

Please sign in to comment.