MCPcopy
hub / github.com/op/go-logging / MustGetLogger

Function MustGetLogger

logger.go:118–124  ·  view source on GitHub ↗

MustGetLogger is like GetLogger but panics if the logger can't be created. It simplifies safe initialization of a global logger for eg. a package.

(module string)

Source from the content-addressed store, hash-verified

116// MustGetLogger is like GetLogger but panics if the logger can't be created.
117// It simplifies safe initialization of a global logger for eg. a package.
118func MustGetLogger(module string) *Logger {
119 logger, err := GetLogger(module)
120 if err != nil {
121 panic("logger: " + module + ": " + err.Error())
122 }
123 return logger
124}
125
126// Reset restores the internal state of the logging library.
127func Reset() {

Callers 15

TestFormatFunction · 0.85
logAndGetLineFunction · 0.85
TestBackendFormatterFunction · 0.85
BenchmarkStringFormatterFunction · 0.85
TestMultiLoggerFunction · 0.85
TestMultiLoggerLevelFunction · 0.85
TestLogCalldepthFunction · 0.85
testCallpathFunction · 0.85
RunLogBenchmarkFunction · 0.85
TestMemoryBackendFunction · 0.85
TestChannelMemoryBackendFunction · 0.85

Calls 2

GetLoggerFunction · 0.85
ErrorMethod · 0.80

Tested by 15

TestFormatFunction · 0.68
logAndGetLineFunction · 0.68
TestBackendFormatterFunction · 0.68
BenchmarkStringFormatterFunction · 0.68
TestMultiLoggerFunction · 0.68
TestMultiLoggerLevelFunction · 0.68
TestLogCalldepthFunction · 0.68
testCallpathFunction · 0.68
RunLogBenchmarkFunction · 0.68
TestMemoryBackendFunction · 0.68
TestChannelMemoryBackendFunction · 0.68