From baa4468b76f7ffd4980a49ce0b555d277b150704 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20Tikvi=C4=87?= Date: Mon, 10 Apr 2017 13:00:25 +0200 Subject: [PATCH] Comments go before errors --- gologger.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/gologger.go b/gologger.go index a960dcc..a545494 100644 --- a/gologger.go +++ b/gologger.go @@ -3,18 +3,18 @@ package gologger import ( "fmt" "os" - "time" "sync" + "time" ) var muEv = &sync.Mutex{} var muEr = &sync.Mutex{} -const MaxLogFileSize5MB int64 = 5*1024*1024 -const MaxLogFileSize1MB int64 = 1*1024*1024 -const MaxLogFileSize500KB int64 = 500*1024 -const MaxLogFileSize100KB int64 = 100*1024 -const MaxLogFileSize512B int64 = 512 +const MaxLogFileSize5MB int64 = 5 * 1024 * 1024 +const MaxLogFileSize1MB int64 = 1 * 1024 * 1024 +const MaxLogFileSize500KB int64 = 500 * 1024 +const MaxLogFileSize100KB int64 = 100 * 1024 +const MaxLogFileSize512B int64 = 512 const ErrDirName = "error-logs" const EvtDirName = "event-logs" @@ -139,6 +139,6 @@ func (l *Logger) LogEvent(event string) { func (l *Logger) LogError(comment string, err error) { muEr.Lock() defer muEr.Unlock() - l.errorf.WriteString(time.Now().Format(time.RFC3339) + ": " + err.Error() + " ::::: " + comment + "\n") + l.errorf.WriteString(time.Now().Format(time.RFC3339) + ": " + comment + ": " + err.Error() + "\n") l.splitErrorLog() } -- 1.8.1.2