github.com/palcoin-project/palcd@v1.0.0/mempool/log.go (about) 1 // Copyright (c) 2013-2016 The btcsuite 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 mempool 6 7 import "github.com/palcoin-project/palclog" 8 9 // log is a logger that is initialized with no output filters. This 10 // means the package will not perform any logging by default until the caller 11 // requests it. 12 var log palclog.Logger 13 14 // The default amount of logging is none. 15 func init() { 16 DisableLog() 17 } 18 19 // DisableLog disables all library log output. Logging output is disabled 20 // by default until either UseLogger or SetLogWriter are called. 21 func DisableLog() { 22 log = palclog.Disabled 23 } 24 25 // UseLogger uses a specified Logger to output package logging info. 26 // This should be used in preference to SetLogWriter if the caller is also 27 // using palclog. 28 func UseLogger(logger palclog.Logger) { 29 log = logger 30 } 31 32 // pickNoun returns the singular or plural form of a noun depending 33 // on the count n. 34 func pickNoun(n int, singular, plural string) string { 35 if n == 1 { 36 return singular 37 } 38 return plural 39 }