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

Method Log

log_windows.go:84–94  ·  view source on GitHub ↗
(level Level, calldepth int, rec *Record)

Source from the content-addressed store, hash-verified

82}
83
84func (b *LogBackend) Log(level Level, calldepth int, rec *Record) error {
85 if b.Color && b.f != nil {
86 buf := &bytes.Buffer{}
87 setConsoleTextAttribute(b.f, colors[level])
88 buf.Write([]byte(rec.Formatted(calldepth + 1)))
89 err := b.Logger.Output(calldepth+2, buf.String())
90 setConsoleTextAttribute(b.f, fgWhite)
91 return err
92 }
93 return b.Logger.Output(calldepth+2, rec.Formatted(calldepth+1))
94}
95
96// setConsoleTextAttribute sets the attributes of characters written to the
97// console screen buffer by the WriteFile or WriteConsole function.

Callers

nothing calls this directly

Calls 3

setConsoleTextAttributeFunction · 0.85
FormattedMethod · 0.80
StringMethod · 0.80

Tested by

no test coverage detected