Skip to content

Commit 9855999

Browse files
authored
Merge pull request #103 from hyperledger-labs/no-logrus-defaults
Do not force logrus LogLevel on first log line
2 parents 9271b8a + b322547 commit 9855999

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed

go-sdk/internal/log/log.go

+2-10
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ var (
3333
initAtLeastOnce atomic.Bool
3434
)
3535

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
3638
func InitConfig() {
3739
initAtLeastOnce.Store(true) // must store before SetLevel
3840

@@ -51,22 +53,12 @@ func InitConfig() {
5153
logrus.SetFormatter(formatter)
5254
}
5355

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-
6256
func logger() *logrus.Entry {
63-
ensureInit()
6457
return rootLogger
6558
}
6659

6760
// WithLogField adds the specified field to the logger in the context
6861
func WithLogField(key, value string) *logrus.Entry {
69-
ensureInit()
7062
if len(value) > 61 {
7163
value = value[0:61] + "..."
7264
}

0 commit comments

Comments
 (0)