From 327c98634f9c72315b9b79776193f0466037915c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20Tikvi=C4=87?= Date: Thu, 1 Feb 2018 11:45:53 +0100 Subject: [PATCH] added Print() for console output --- main.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/main.go b/main.go index 5f45d89..961e649 100644 --- a/main.go +++ b/main.go @@ -54,7 +54,7 @@ func Init(eventFileName, errorFileName string) error { logger.eventFileName = eventFileName logger.errorFileName = errorFileName - path := filepath.Join(EvtDirName, eventFileName+timestamp) + path := filepath.Join(EvtDirName, eventFileName+timestamp+".txt") logger.eventf, err = os.Create(path) if err != nil { @@ -62,7 +62,7 @@ func Init(eventFileName, errorFileName string) error { return err } - path = filepath.Join(ErrDirName, errorFileName+timestamp) + path = filepath.Join(ErrDirName, errorFileName+timestamp+".txt") logger.errorf, err = os.Create(path) if err != nil { @@ -73,6 +73,10 @@ func Init(eventFileName, errorFileName string) error { return nil } +func Print(s string) { + fmt.Printf(time.Now().Format(time.RFC3339) + ": " + s + "\n") +} + func LogEvent(event string) { muEv.Lock() defer muEv.Unlock() -- 1.8.1.2