File tree 1 file changed +2
-10
lines changed
1 file changed +2
-10
lines changed Original file line number Diff line number Diff line change 33
33
initAtLeastOnce atomic.Bool
34
34
)
35
35
36
+ // Optional to call if you wish to use Zeto's configuration for logging.
37
+ // Otherwise standard logrus logging will be used as configured by your own environment
36
38
func InitConfig () {
37
39
initAtLeastOnce .Store (true ) // must store before SetLevel
38
40
@@ -51,22 +53,12 @@ func InitConfig() {
51
53
logrus .SetFormatter (formatter )
52
54
}
53
55
54
- func ensureInit () {
55
- // Called at a couple of strategic points to check we get log initialize in things like unit tests
56
- // However NOT guaranteed to be called because we can't afford to do atomic load on every log line
57
- if ! initAtLeastOnce .Load () {
58
- InitConfig ()
59
- }
60
- }
61
-
62
56
func logger () * logrus.Entry {
63
- ensureInit ()
64
57
return rootLogger
65
58
}
66
59
67
60
// WithLogField adds the specified field to the logger in the context
68
61
func WithLogField (key , value string ) * logrus.Entry {
69
- ensureInit ()
70
62
if len (value ) > 61 {
71
63
value = value [0 :61 ] + "..."
72
64
}
You can’t perform that action at this time.
0 commit comments