From da2c37bb955bbdfceb95bbcc48e1267716152804 Mon Sep 17 00:00:00 2001 From: Alex Auvolat Date: Sat, 1 Feb 2020 15:05:44 +0100 Subject: Better logging --- ldapserver/logger.go | 32 +++++++------------------------- 1 file changed, 7 insertions(+), 25 deletions(-) (limited to 'ldapserver/logger.go') 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) -) -- cgit v1.2.3