xmpp/log.go
changeset 183 b4bd77d58a3e
parent 182 626c390682fc
parent 181 750bc33ccdda
child 184 ce49140fe60b
equal deleted inserted replaced
182:626c390682fc 183:b4bd77d58a3e
     1 // Control over logging from the XMPP library.
       
     2 
       
     3 package xmpp
       
     4 
       
     5 var (
       
     6 	// If any of these are non-nil when NewClient() is called,
       
     7 	// they will be used to log messages of the indicated
       
     8 	// severity.
       
     9 	Warn  Logger = &noLog{}
       
    10 	Info  Logger = &noLog{}
       
    11 	Debug Logger = &noLog{}
       
    12 )
       
    13 
       
    14 // Anything implementing Logger can receive log messages from the XMPP
       
    15 // library. The default implementation doesn't log anything; it
       
    16 // efficiently discards all messages.
       
    17 type Logger interface {
       
    18 	Log(v ...interface{})
       
    19 	Logf(fmt string, v ...interface{})
       
    20 }
       
    21 
       
    22 type noLog struct {
       
    23 	flags  int
       
    24 	prefix string
       
    25 }
       
    26 
       
    27 var _ Logger = &noLog{}
       
    28 
       
    29 func (l *noLog) Log(v ...interface{}) {
       
    30 }
       
    31 
       
    32 func (l *noLog) Logf(fmt string, v ...interface{}) {
       
    33 }