aboutsummaryrefslogtreecommitdiff
path: root/ldapserver/logger.go
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2020-02-01 15:05:44 +0100
committerAlex Auvolat <alex@adnab.me>2020-02-01 15:05:44 +0100
commitda2c37bb955bbdfceb95bbcc48e1267716152804 (patch)
treee04a071472b81af6713d7107cdebce66ec217de2 /ldapserver/logger.go
parentc3bfcdf9a1c80b9ed27840f203cf3f14ef0bb113 (diff)
downloadbottin-da2c37bb955bbdfceb95bbcc48e1267716152804.tar.gz
bottin-da2c37bb955bbdfceb95bbcc48e1267716152804.zip
Better logging
Diffstat (limited to 'ldapserver/logger.go')
-rw-r--r--ldapserver/logger.go32
1 files changed, 7 insertions, 25 deletions
diff --git a/ldapserver/logger.go b/ldapserver/logger.go
index 9f145cf..9286956 100644
--- a/ldapserver/logger.go
+++ b/ldapserver/logger.go
@@ -1,36 +1,18 @@
package ldapserver
import (
- "io/ioutil"
- "log"
"os"
-)
-
-var Logger logger
-
-const DEBUG = false
-const TRACE = false
-// Logger represents log.Logger functions from the standard library
-type logger interface {
- Fatal(v ...interface{})
- Fatalf(format string, v ...interface{})
- Fatalln(v ...interface{})
+ log "github.com/sirupsen/logrus"
+)
- Panic(v ...interface{})
- Panicf(format string, v ...interface{})
- Panicln(v ...interface{})
+var Logger *log.Logger
- Print(v ...interface{})
- Printf(format string, v ...interface{})
- Println(v ...interface{})
-}
func init() {
- Logger = log.New(os.Stdout, "", log.LstdFlags)
+ Logger = log.New()
+ Logger.SetOutput(os.Stdout)
+ Logger.SetFormatter(&log.TextFormatter{})
+ Logger.SetLevel(log.InfoLevel)
}
-var (
- // DiscardingLogger can be used to disable logging output
- DiscardingLogger = log.New(ioutil.Discard, "", 0)
-)