Simple adapter to utilise GLog with goirc.

This commit is contained in:
Alex Bramley 2013-09-27 22:31:33 +01:00
parent 5bb0c8278d
commit 12eb9c89eb
1 changed files with 20 additions and 0 deletions

20
logging/glog/glog.go Normal file
View File

@ -0,0 +1,20 @@
package glog
import (
"github.com/golang/glog"
)
// Simple adapter to utilise Google's GLog package with goirc.
// Just import github.com/fluffle/goirc/logging and this package,
// then call logging.Logger(glog.GLogger{}).
// The unfortunate downside of this is that it adds an extra hop
// to the caller chain which means *all* the line numbers are bad.
type GLogger struct{}
func (gl GLogger) Debug(f string, a ...interface{}) {
// GLog doesn't have a "Debug" level, so use V(2) instead.
glog.V(2).Infof(f, a...)
}
func (gl GLogger) Info(f string, a ...interface{}) { glog.Infof(f, a...) }
func (gl GLogger) Warn(f string, a ...interface{}) { glog.Warningf(f, a...) }
func (gl GLogger) Error(f string, a ...interface{}) { glog.Errorf(f, a...) }