-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexample.go
43 lines (34 loc) · 1012 Bytes
/
example.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// +build linux windows
// +build amd64 arm
package main
import (
"github.com/mariuspass/mlog"
)
var (
log *mlog.Log
)
func main() {
// get the log instance
log = mlog.Get()
// set custom timestamp format
log.SetTimeFormat("02-01-2006 15:04:05")
// log to file log.txt
log.SetFileWriter("log.txt")
// Messages without formatting
println("Messages without formatting:")
log.Debug("Debug Message")
log.Notice("Notice Message")
log.Error("Error Message")
log.Info("Info Message")
log.Warning("Warning Message")
// log.Critical("Critical Message")
// Messages with formatting (using format 'verbs' from: https://golang.org/pkg/fmt/)
println("")
println("Messages with formatting (using format 'verbs' from: https://golang.org/pkg/fmt/):")
log.Debug("%s", "Debug Message")
log.Notice("%s", "Notice Message")
log.Error("%s", "Error Message")
log.Info("%s", "Info Message")
log.Warning("%s", "Warning Message")
log.Critical("%s", "Critical Error, Program will exit after this call")
}