log.go 624 B

1234567891011121314151617181920212223242526272829303132
  1. package log
  2. import (
  3. "fmt"
  4. "github.com/golang/glog"
  5. )
  6. func Debug(msg string) {
  7. glog.V(1).Info(fmt.Sprintf("[DEBUG]\t%s", msg))
  8. }
  9. func Info(msg string) {
  10. glog.Info(fmt.Sprintf("[INFO]\t%s", msg))
  11. }
  12. func Warning(msg string) {
  13. glog.InfoDepth(1, fmt.Sprintf("[WARNING]\t%s", msg))
  14. }
  15. func Error(msg string) {
  16. glog.InfoDepth(2, fmt.Sprintf("[ERROR]\t%s", msg))
  17. }
  18. func Flush() {
  19. glog.Flush()
  20. }
  21. type ABTestLogger struct{}
  22. func (l ABTestLogger) Infof(msg string, args ...interface{}) {
  23. Info(fmt.Sprintf(msg, args...))
  24. }
  25. func (l ABTestLogger) Errorf(msg string, args ...interface{}) {
  26. Error(fmt.Sprintf(msg, args...))
  27. }