MCPcopy Index your code
hub / github.com/DoNewsCode/core / WithLevel

Function WithLevel

logging/log.go:206–211  ·  view source on GitHub ↗

WithLevel decorates the logger and returns a contract.LevelLogger. Note: Don't inject contract.LevelLogger to dependency consumers directly as this will weaken the powerful abstraction of log.Logger. Only inject log.Logger, and converts log.Logger to contract.LevelLogger within the boundary of depe

(logger log.Logger)

Source from the content-addressed store, hash-verified

204// log.Logger, and converts log.Logger to contract.LevelLogger within the
205// boundary of dependency consumer if desired.
206func WithLevel(logger log.Logger) LevelLogger {
207 if l, ok := logger.(LevelLogger); ok {
208 return l
209 }
210 return levelLogger{log.With(logger, "caller", log.Caller(5))}
211}

Callers 10

TestServeIn_signalWatchFunction · 0.92
NewFunction · 0.92
newServeCmdFunction · 0.92
NewCleanupCommandFunction · 0.92
ExampleWithLevelFunction · 0.92
Example_sprintfFunction · 0.92
ProvideCommandMethod · 0.92
TestWithLevelFunction · 0.85
TestLevelFilterFunction · 0.85

Calls 1

WithMethod · 0.45

Tested by 6

TestServeIn_signalWatchFunction · 0.74
ExampleWithLevelFunction · 0.74
Example_sprintfFunction · 0.74
TestWithLevelFunction · 0.68
TestLevelFilterFunction · 0.68