github.com/decred/politeia@v1.4.0/politeiawww/legacy/codetracker/github/database/cockroachdb/log.go (about) 1 // Copyright (c) 2020 The Decred developers 2 // Use of this source code is governed by an ISC 3 // license that can be found in the LICENSE file. 4 5 package cockroachdb 6 7 import ( 8 "github.com/decred/politeia/politeiawww/logger" 9 "github.com/decred/slog" 10 ) 11 12 // log is a logger that is initialized with no output filters. This 13 // means the package will not perform any logging by default until the caller 14 // requests it. 15 var log = slog.Disabled 16 17 // DisableLog disables all library log output. Logging output is disabled 18 // by default until either UseLogger or SetLogWriter are called. 19 func DisableLog() { 20 log = slog.Disabled 21 } 22 23 // UseLogger uses a specified Logger to output package logging info. 24 // This should be used in preference to SetLogWriter if the caller is also 25 // using slog. 26 func UseLogger(logger slog.Logger) { 27 log = logger 28 } 29 30 // Initialize the package logger. 31 func init() { 32 UseLogger(logger.NewSubsystem("GHDB")) 33 }