From 7cea7ea9e2ada219918de831cbdfa90e842bad5c Mon Sep 17 00:00:00 2001 From: Zack Scholl Date: Sun, 22 Apr 2018 23:24:13 -0700 Subject: [PATCH] Add new logging --- logging.go | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 logging.go diff --git a/logging.go b/logging.go new file mode 100644 index 00000000..924e3a7c --- /dev/null +++ b/logging.go @@ -0,0 +1,48 @@ +package main + +import ( + log "github.com/cihub/seelog" +) + +func init() { + + SetLogLevel("debug") +} + +// SetLogLevel determines the log level +func SetLogLevel(level string) (err error) { + + // https://en.wikipedia.org/wiki/ANSI_escape_code#3/4_bit + // https://github.com/cihub/seelog/wiki/Log-levels + appConfig := ` + + + + + + + + + + + + + + + + + + + + + + + + ` + logger, err := log.LoggerFromConfigAsBytes([]byte(appConfig)) + if err != nil { + return + } + log.ReplaceLogger(logger) + return +}