Commit 327c98634f9c72315b9b79776193f0466037915c
1 parent
2f4b177f08
Exists in
master
added Print() for console output
Showing
1 changed file
with
6 additions
and
2 deletions
Show diff stats
main.go
... | ... | @@ -54,7 +54,7 @@ func Init(eventFileName, errorFileName string) error { |
54 | 54 | logger.eventFileName = eventFileName |
55 | 55 | logger.errorFileName = errorFileName |
56 | 56 | |
57 | - path := filepath.Join(EvtDirName, eventFileName+timestamp) | |
57 | + path := filepath.Join(EvtDirName, eventFileName+timestamp+".txt") | |
58 | 58 | logger.eventf, err = os.Create(path) |
59 | 59 | |
60 | 60 | if err != nil { |
... | ... | @@ -62,7 +62,7 @@ func Init(eventFileName, errorFileName string) error { |
62 | 62 | return err |
63 | 63 | } |
64 | 64 | |
65 | - path = filepath.Join(ErrDirName, errorFileName+timestamp) | |
65 | + path = filepath.Join(ErrDirName, errorFileName+timestamp+".txt") | |
66 | 66 | logger.errorf, err = os.Create(path) |
67 | 67 | |
68 | 68 | if err != nil { |
... | ... | @@ -73,6 +73,10 @@ func Init(eventFileName, errorFileName string) error { |
73 | 73 | return nil |
74 | 74 | } |
75 | 75 | |
76 | +func Print(s string) { | |
77 | + fmt.Printf(time.Now().Format(time.RFC3339) + ": " + s + "\n") | |
78 | +} | |
79 | + | |
76 | 80 | func LogEvent(event string) { |
77 | 81 | muEv.Lock() |
78 | 82 | defer muEv.Unlock() | ... | ... |