Skip to content

Commit a389e4e

Browse files
author
zbh255
committed
Update Document
1 parent 75c97c2 commit a389e4e

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ func main() {
3434

3535
```go
3636
func main() {
37-
logger := bilog.NewLogger(os.Stdout,bilog.PANIC,bilog.WithDefault(),bilog.WithCaller())
37+
logger := bilog.NewLogger(os.Stdout,bilog.PANIC,bilog.WithDefault(),bilog.WithCaller(0))
3838
logger.Trace("hello world!")
3939
logger.Debug("hello world!")
4040
logger.Flush()

options.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ func WithDefault() WithFunc {
3636
}
3737
}
3838

39+
// WithCaller 指定是否输出源代码文件/行号信息, offSet指定在默认输出深度上的偏移值
40+
// 有默认值是因为bilog内部在调用runtime.Callers时也有一定深度的封装, 这导致需要调整寻找的栈深度
3941
func WithCaller(offSet int) WithFunc {
4042
return func(options *loggerConfig) {
4143
options.st.start = true

0 commit comments

Comments
 (0)