log.go
author Chris Jones <christian.jones@sri.com>
Fri, 28 Dec 2012 17:56:13 -0700
changeset 115 7c45fc3f524a
parent 102 872e936f9f3f
child 116 5c6d6d51d3ba
permissions -rw-r--r--
Put the sub-elements of Message and Presence into the jabber:client namespace.

// Copyright 2011 The Go Authors.  All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

// Control over logging from the XMPP library.

package xmpp

var (
	// If any of these are non-nil when NewClient() is called,
	// they will be used to log messages of the indicated
	// severity.
	Warn Logger = &noLog{}
	Info Logger = &noLog{}
	Debug Logger = &noLog{}
)

// Anything implementing Logger can receive log messages from the XMPP
// library. The default implementation doesn't log anything; it
// efficiently discards all messages.
type Logger interface {
	Log(v ...interface{})
	Logf(fmt string, v ...interface{})
}

type noLog struct {
	flags  int
	prefix string
}
var _ Logger = &noLog{}

func (l *noLog) Log(v ...interface{}) {
}

func (l *noLog) Logf(fmt string, v ...interface{}) {
}