aboutsummaryrefslogtreecommitdiff
path: root/ldapserver/logger.go
diff options
context:
space:
mode:
Diffstat (limited to 'ldapserver/logger.go')
-rw-r--r--ldapserver/logger.go33
1 files changed, 33 insertions, 0 deletions
diff --git a/ldapserver/logger.go b/ldapserver/logger.go
new file mode 100644
index 0000000..fdac2f4
--- /dev/null
+++ b/ldapserver/logger.go
@@ -0,0 +1,33 @@
+package ldapserver
+
+import (
+ "io/ioutil"
+ "log"
+ "os"
+)
+
+var Logger logger
+
+// Logger represents log.Logger functions from the standard library
+type logger interface {
+ Fatal(v ...interface{})
+ Fatalf(format string, v ...interface{})
+ Fatalln(v ...interface{})
+
+ Panic(v ...interface{})
+ Panicf(format string, v ...interface{})
+ Panicln(v ...interface{})
+
+ Print(v ...interface{})
+ Printf(format string, v ...interface{})
+ Println(v ...interface{})
+}
+
+func init() {
+ Logger = log.New(os.Stdout, "", log.LstdFlags)
+}
+
+var (
+ // DiscardingLogger can be used to disable logging output
+ DiscardingLogger = log.New(ioutil.Discard, "", 0)
+)