summaryrefslogtreecommitdiff
path: root/log.go
diff options
context:
space:
mode:
authorAndrew Gallant <[email protected]>2013-08-22 19:30:46 -0700
committerAndrew Gallant <[email protected]>2013-08-22 19:30:46 -0700
commitd310a02534d5a8910b6b2b2cdba9e71420fb0762 (patch)
tree8b29768f8dec371458ead98b1bd7f0d981adf9bc /log.go
parenteb7c38953b074e33f86861a3da4c05623cd44fc6 (diff)
parentd9eaa7fc3887a20142a4b27eebe0ee9afbcc1a13 (diff)
Merge pull request #10 from Merovius/logging
Export the logger (again)
Diffstat (limited to 'log.go')
-rw-r--r--log.go85
1 files changed, 0 insertions, 85 deletions
diff --git a/log.go b/log.go
deleted file mode 100644
index eaaa57e..0000000
--- a/log.go
+++ /dev/null
@@ -1,85 +0,0 @@
-package xgb
-
-import (
- "log"
- "os"
-)
-
-// Log controls whether XGB emits errors to stderr. By default, it is enabled.
-var PrintLog = true
-
-// log is a wrapper around a log.PrintLogger so we can control whether it should
-// output anything.
-type xgblog struct {
- *log.Logger
-}
-
-func newLogger() xgblog {
- return xgblog{log.New(os.Stderr, "XGB: ", log.Lshortfile)}
-}
-
-func (lg xgblog) Print(v ...interface{}) {
- if PrintLog {
- lg.Logger.Print(v...)
- }
-}
-
-func (lg xgblog) Printf(format string, v ...interface{}) {
- if PrintLog {
- lg.Logger.Printf(format, v...)
- }
-}
-
-func (lg xgblog) Println(v ...interface{}) {
- if PrintLog {
- lg.Logger.Println(v...)
- }
-}
-
-func (lg xgblog) Fatal(v ...interface{}) {
- if PrintLog {
- lg.Logger.Fatal(v...)
- } else {
- os.Exit(1)
- }
-}
-
-func (lg xgblog) Fatalf(format string, v ...interface{}) {
- if PrintLog {
- lg.Logger.Fatalf(format, v...)
- } else {
- os.Exit(1)
- }
-}
-
-func (lg xgblog) Fatalln(v ...interface{}) {
- if PrintLog {
- lg.Logger.Fatalln(v...)
- } else {
- os.Exit(1)
- }
-}
-
-func (lg xgblog) Panic(v ...interface{}) {
- if PrintLog {
- lg.Logger.Panic(v...)
- } else {
- panic("")
- }
-}
-
-func (lg xgblog) Panicf(format string, v ...interface{}) {
- if PrintLog {
- lg.Logger.Panicf(format, v...)
- } else {
- panic("")
- }
-}
-
-func (lg xgblog) Panicln(v ...interface{}) {
- if PrintLog {
- lg.Logger.Panicln(v...)
- } else {
- panic("")
- }
-}