mirror of https://github.com/fluffle/goirc
Simple adapter to utilise GLog with goirc.
This commit is contained in:
parent
5bb0c8278d
commit
12eb9c89eb
|
@ -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...) }
|
Loading…
Reference in New Issue