/usr/share/gocode/src/github.com/lxc/lxd/shared/log.go is in golang-github-lxc-lxd-dev 2.0.2-0ubuntu1~16.04.1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | package shared
import (
"fmt"
"runtime"
)
type Logger interface {
Debug(msg string, ctx ...interface{})
Info(msg string, ctx ...interface{})
Warn(msg string, ctx ...interface{})
Error(msg string, ctx ...interface{})
Crit(msg string, ctx ...interface{})
}
var Log Logger
type nullLogger struct{}
func (nl nullLogger) Debug(msg string, ctx ...interface{}) {}
func (nl nullLogger) Info(msg string, ctx ...interface{}) {}
func (nl nullLogger) Warn(msg string, ctx ...interface{}) {}
func (nl nullLogger) Error(msg string, ctx ...interface{}) {}
func (nl nullLogger) Crit(msg string, ctx ...interface{}) {}
func init() {
Log = nullLogger{}
}
// Logf sends to the logger registered via SetLogger the string resulting
// from running format and args through Sprintf.
func Logf(format string, args ...interface{}) {
if Log != nil {
Log.Info(fmt.Sprintf(format, args...))
}
}
// Debugf sends to the logger registered via SetLogger the string resulting
// from running format and args through Sprintf, but only if debugging was
// enabled via SetDebug.
func Debugf(format string, args ...interface{}) {
if Log != nil {
Log.Debug(fmt.Sprintf(format, args...))
}
}
func PrintStack() {
buf := make([]byte, 1<<16)
runtime.Stack(buf, true)
Debugf("%s", buf)
}
|