MCPcopy Index your code
hub / github.com/dearcode/candy / Log

Method Log

util/log/log.go:117–131  ·  view source on GitHub ↗
(t int, info string)

Source from the content-addressed store, hash-verified

115}
116
117func (l *logger) Log(t int, info string) {
118 if t > l.level {
119 return
120 }
121
122 header, name := l.caller()
123
124 logStr, logColor := LogTypeToString(t)
125
126 if l.color {
127 fmt.Fprintln(l.out, header, fmt.Sprint("\033", logColor, "m[", logStr, "] ", name, " ", info, "\033[0m"))
128 } else {
129 fmt.Fprintln(l.out, header, "[", logStr, "]", name, " ", info)
130 }
131}
132
133func StringToLogLevel(level string) int {
134 switch level {

Callers 10

InfoFunction · 0.80
InfofFunction · 0.80
DebugFunction · 0.80
DebugfFunction · 0.80
WarningFunction · 0.80
WarningfFunction · 0.80
ErrorFunction · 0.80
ErrorfFunction · 0.80
FatalFunction · 0.80
FatalfFunction · 0.80

Calls 2

callerMethod · 0.95
LogTypeToStringFunction · 0.85

Tested by

no test coverage detected