Skip to content

Commit

Permalink
log: add caller during the log printing
Browse files Browse the repository at this point in the history
Changelog-Fixed: add caller during the log printing

Signed-off-by: Vincenzo Palazzo <[email protected]>
  • Loading branch information
vincenzopalazzo committed Apr 2, 2022
1 parent e23f2fa commit 8ddd34c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
**/vendor
db/leveldb/db/

.idea/
9 changes: 6 additions & 3 deletions log/log.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ type singleton struct {
var instance singleton

func init() {
_ = InitLogger("", "debug", false)
_ = InitLogger("", "debug", true)
}

func GetInstance() *singleton {
Expand Down Expand Up @@ -76,9 +76,12 @@ func InitLogger(customPath string, level string, callerTrace bool) error {
}

instance.Log = logrus.New()
// TODO report this error
logLevel, _ := parseLogLevel(level)
logLevel, err := parseLogLevel(level)
if err != nil {
return err
}
instance.Log.SetLevel(logLevel)
instance.Log.SetReportCaller(callerTrace)

if callerTrace {
instance.Log.SetReportCaller(true)
Expand Down

0 comments on commit 8ddd34c

Please sign in to comment.