Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
sundowndev
GitHub Repository: sundowndev/phoneinfoga
Path: blob/master/logs/config.go
988 views
1
package logs
2
3
import (
4
"github.com/sirupsen/logrus"
5
"github.com/sundowndev/phoneinfoga/v2/build"
6
"os"
7
)
8
9
type Config struct {
10
Level logrus.Level
11
ReportCaller bool
12
}
13
14
func getConfig() Config {
15
config := Config{
16
Level: logrus.WarnLevel,
17
ReportCaller: false,
18
}
19
20
if !build.IsRelease() {
21
config.Level = logrus.DebugLevel
22
}
23
24
if lvl := os.Getenv("LOG_LEVEL"); lvl != "" {
25
loglevel, _ := logrus.ParseLevel(lvl)
26
config.Level = loglevel
27
}
28
29
return config
30
}
31
32