Browse Source
logging: Use `RedirectStdLog` to capture more stdlib logs (#4732)
* logging: Use `RedirectStdLog`
* .gitignore a file pattern that I'm constantly using for testing
master
Francis Lavoie
4 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with
8 additions and
1 deletions
-
.gitignore
-
logging.go
|
|
@ -1,6 +1,7 @@ |
|
|
_gitignore/ |
|
|
_gitignore/ |
|
|
*.log |
|
|
*.log |
|
|
Caddyfile |
|
|
Caddyfile |
|
|
|
|
|
Caddyfile.* |
|
|
!caddyfile/ |
|
|
!caddyfile/ |
|
|
|
|
|
|
|
|
# artifacts from pprof tooling |
|
|
# artifacts from pprof tooling |
|
|
|
|
|
@ -661,9 +661,15 @@ func newDefaultProductionLog() (*defaultCustomLog, error) { |
|
|
|
|
|
|
|
|
cl.buildCore() |
|
|
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{ |
|
|
return &defaultCustomLog{ |
|
|
CustomLog: cl, |
|
|
CustomLog: cl, |
|
|
logger: zap.New(cl.core), |
|
|
logger: logger, |
|
|
}, nil |
|
|
}, nil |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|