blob: 6595df00296676bec280cceaf01f7a49ca6d9da4 [file] [log] [blame]
Matthias Andreas Benkard832a54e2019-01-29 09:27:38 +01001package restful
2
3// Copyright 2014 Ernest Micklei. All rights reserved.
4// Use of this source code is governed by a license
5// that can be found in the LICENSE file.
6import (
7 "github.com/emicklei/go-restful/log"
8)
9
10var trace bool = false
11var traceLogger log.StdLogger
12
13func init() {
14 traceLogger = log.Logger // use the package logger by default
15}
16
17// TraceLogger enables detailed logging of Http request matching and filter invocation. Default no logger is set.
18// You may call EnableTracing() directly to enable trace logging to the package-wide logger.
19func TraceLogger(logger log.StdLogger) {
20 traceLogger = logger
21 EnableTracing(logger != nil)
22}
23
24// SetLogger exposes the setter for the global logger on the top-level package
25func SetLogger(customLogger log.StdLogger) {
26 log.SetLogger(customLogger)
27}
28
29// EnableTracing can be used to Trace logging on and off.
30func EnableTracing(enabled bool) {
31 trace = enabled
32}