-
Notifications
You must be signed in to change notification settings - Fork 10
/
helpers.go
66 lines (63 loc) · 1.21 KB
/
helpers.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
package log
import (
"github.com/totoval/framework/errors"
"github.com/totoval/framework/helpers/toto"
"github.com/totoval/framework/logs"
)
func Error(err error, v ...toto.V) error {
var fields toto.V
if len(v) > 0 {
fields = v[0]
}
errors.ErrPrintln(err, fields)
return err
}
func Info(msg string, v ...toto.V) {
var fields toto.V
if len(v) > 0 {
fields = v[0]
}
logs.Println(logs.INFO, msg, fields)
}
func Warn(msg string, v ...toto.V) {
var fields toto.V
if len(v) > 0 {
fields = v[0]
}
logs.Println(logs.WARN, msg, fields)
}
func Fatal(msg string, v ...toto.V) {
var fields toto.V
if len(v) > 0 {
fields = v[0]
}
logs.Println(logs.FATAL, msg, fields)
}
func Debug(msg string, v ...toto.V) {
var fields toto.V
if len(v) > 0 {
fields = v[0]
}
logs.Println(logs.DEBUG, msg, fields)
}
func Panic(msg string, v ...toto.V) {
var fields toto.V
if len(v) > 0 {
fields = v[0]
}
logs.Println(logs.PANIC, msg, fields)
}
func Trace(msg string, v ...toto.V) {
var fields toto.V
if len(v) > 0 {
fields = v[0]
}
logs.Println(logs.TRACE, msg, fields)
}
func ErrorStr(err error, v ...toto.V) string {
var fields toto.V
if len(v) > 0 {
fields = v[0]
}
return errors.ErrPrint(err, 2, fields)
}