5
type Logger interface {
6
Output(calldepth int, s string) error
9
var globalLogger Logger
14
dbgPrefix = "JUJU:DEBUG "
17
// Specify the *log.Logger object where log messages should be sent to.
18
func SetLogger(logger Logger) {
22
// Enable the delivery of debug messages to the logger. Only meaningful
23
// if a logger is also set.
24
func SetDebug(debug bool) {
28
// Logf logs the formatted message onto the Logger set via SetLogger.
29
func Logf(format string, v ...interface{}) {
30
if globalLogger != nil {
31
globalLogger.Output(2, logPrefix+fmt.Sprintf(format, v...))
35
// Debugf logs the formatted message onto the Logger set via SetLogger,
36
// as long as debugging was enabled with SetDebug.
37
func Debugf(format string, v ...interface{}) {
38
if globalDebug && globalLogger != nil {
39
globalLogger.Output(2, dbgPrefix+fmt.Sprintf(format, v...))