diff options
Diffstat (limited to 'src/logger.go')
-rw-r--r-- | src/logger.go | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/logger.go b/src/logger.go new file mode 100644 index 0000000..117fe5b --- /dev/null +++ b/src/logger.go @@ -0,0 +1,35 @@ +package main + +import ( + "log" + "os" +) + +const ( + LogLevelError = iota + LogLevelInfo + LogLevelDebug +) + +type Logger struct { + Debug *log.Logger + Info *log.Logger + Error *log.Logger +} + +func NewLogger() *Logger { + logger := new(Logger) + logger.Debug = log.New(os.Stdout, + "DEBUG: ", + log.Ldate|log.Ltime|log.Lshortfile, + ) + logger.Info = log.New(os.Stdout, + "INFO: ", + log.Ldate|log.Ltime|log.Lshortfile, + ) + logger.Error = log.New(os.Stdout, + "ERROR: ", + log.Ldate|log.Ltime|log.Lshortfile, + ) + return logger +} |