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