log.go
changeset 102 872e936f9f3f
child 116 5c6d6d51d3ba
equal deleted inserted replaced
101:5d721a565503 102:872e936f9f3f
       
     1 // Copyright 2011 The Go Authors.  All rights reserved.
       
     2 // Use of this source code is governed by a BSD-style
       
     3 // license that can be found in the LICENSE file.
       
     4 
       
     5 // Control over logging from the XMPP library.
       
     6 
       
     7 package xmpp
       
     8 
       
     9 var (
       
    10 	// If any of these are non-nil when NewClient() is called,
       
    11 	// they will be used to log messages of the indicated
       
    12 	// severity.
       
    13 	Warn Logger = &noLog{}
       
    14 	Info Logger = &noLog{}
       
    15 	Debug Logger = &noLog{}
       
    16 )
       
    17 
       
    18 // Anything implementing Logger can receive log messages from the XMPP
       
    19 // library. The default implementation doesn't log anything; it
       
    20 // efficiently discards all messages.
       
    21 type Logger interface {
       
    22 	Log(v ...interface{})
       
    23 	Logf(fmt string, v ...interface{})
       
    24 }
       
    25 
       
    26 type noLog struct {
       
    27 	flags  int
       
    28 	prefix string
       
    29 }
       
    30 var _ Logger = &noLog{}
       
    31 
       
    32 func (l *noLog) Log(v ...interface{}) {
       
    33 }
       
    34 
       
    35 func (l *noLog) Logf(fmt string, v ...interface{}) {
       
    36 }