aboutsummaryrefslogtreecommitdiffhomepage
path: root/context.go
diff options
context:
space:
mode:
authorMatt Holt <[email protected]>2019-10-28 14:39:37 -0600
committerGitHub <[email protected]>2019-10-28 14:39:37 -0600
commitb00dfd3965f400956c5bb5b388e9d54ef98052e5 (patch)
tree44517743815327f7ef63405b3a13e54f7f20c885 /context.go
parent6c533558a3db4b30a6b7a81d19ac180fe2000ca2 (diff)
downloadcaddy-b00dfd3965f400956c5bb5b388e9d54ef98052e5.tar.gz
caddy-b00dfd3965f400956c5bb5b388e9d54ef98052e5.zip
v2: Logging! (#2831)
* logging: Initial implementation * logging: More encoder formats, better defaults * logging: Fix repetition bug with FilterEncoder; add more presets * logging: DiscardWriter; delete or no-op logs that discard their output * logging: Add http.handlers.log module; enhance Replacer methods The Replacer interface has new methods to customize how to handle empty or unrecognized placeholders. Closes #2815. * logging: Overhaul HTTP logging, fix bugs, improve filtering, etc. * logging: General cleanup, begin transitioning to using new loggers * Fixes after merge conflict
Diffstat (limited to 'context.go')
-rw-r--r--context.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/context.go b/context.go
index d196c71b6..32368a9a4 100644
--- a/context.go
+++ b/context.go
@@ -22,6 +22,7 @@ import (
"reflect"
"github.com/mholt/certmagic"
+ "go.uber.org/zap"
)
// Context is a type which defines the lifetime of modules that
@@ -206,3 +207,8 @@ func (ctx Context) App(name string) (interface{}, error) {
func (ctx Context) Storage() certmagic.Storage {
return ctx.cfg.storage
}
+
+// Logger returns a logger that can be used by mod.
+func (ctx Context) Logger(mod Module) *zap.Logger {
+ return ctx.cfg.Logging.Logger(mod)
+}