github.com/decred/dcrlnd@v0.7.6/lnrpc/verrpc/log.go (about) 1 package verrpc 2 3 import ( 4 "github.com/decred/dcrlnd/build" 5 "github.com/decred/slog" 6 ) 7 8 // log is a logger that is initialized with no output filters. This 9 // means the package will not perform any logging by default until the caller 10 // requests it. 11 var log slog.Logger 12 13 // Subsystem defines the logging code for this subsystem. 14 const Subsystem = "VRPC" 15 16 // The default amount of logging is none. 17 func init() { 18 UseLogger(build.NewSubLogger(Subsystem, nil)) 19 } 20 21 // DisableLog disables all library log output. Logging output is disabled 22 // by default until UseLogger is called. 23 func DisableLog() { 24 UseLogger(slog.Disabled) 25 } 26 27 // UseLogger uses a specified Logger to output package logging info. 28 // This should be used in preference to SetLogWriter if the caller is also 29 // using slog. 30 func UseLogger(logger slog.Logger) { 31 log = logger 32 }