diff --git a/logging/glog/glog.go b/logging/glog/glog.go new file mode 100644 index 0000000..ff87725 --- /dev/null +++ b/logging/glog/glog.go @@ -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...) }