Skip to content

Commit

Permalink
Update: 自定义日志记录器, 重写Printf方法, 以修正日志输出文件的路径值
Browse files Browse the repository at this point in the history
  • Loading branch information
kerbalwzy committed Nov 4, 2021
1 parent aa8c609 commit 61ea2e3
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions u_logger.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package kerbalwzygo

import (
"fmt"
"log"
"os"
"sync"
Expand Down Expand Up @@ -31,6 +32,11 @@ func (obj *XLogger) Level() Level {
return obj.level
}

// Printf rewrite for correct 'calldepth' value
func (obj *XLogger) Printf(format string, v ...interface{}) {
_ = obj.Output(3, fmt.Sprintf(format, v...))
}

func (obj *XLogger) Debug(msg ...interface{}) {
if obj.level > Debug {
return
Expand Down

0 comments on commit 61ea2e3

Please sign in to comment.