1
0
mirror of https://github.com/astaxie/beego.git synced 2024-12-22 02:00:55 +00:00

Merge pull request #4252 from flycash/fix/adapter

Reset func call depth & add adapter.sh
This commit is contained in:
Ming Deng 2020-10-06 18:33:45 +08:00 committed by GitHub
commit 2708916f96
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 4 deletions

View File

@ -86,9 +86,6 @@ type Logger interface {
Flush()
}
var adapters = make(map[string]newLoggerFunc)
var levelPrefix = [LevelDebug + 1]string{"[M]", "[A]", "[C]", "[E]", "[W]", "[N]", "[I]", "[D]"}
// Register makes a log provide available by the provided name.
// If Register is called twice with the same name or if driver is nil,
// it panics.
@ -344,3 +341,7 @@ func Debug(f interface{}, v ...interface{}) {
func Trace(f interface{}, v ...interface{}) {
logs.Trace(f, v...)
}
func init() {
SetLogFuncCallDepth(4)
}

View File

@ -142,7 +142,7 @@ var logMsgPool *sync.Pool
func NewLogger(channelLens ...int64) *BeeLogger {
bl := new(BeeLogger)
bl.level = LevelDebug
bl.loggerFuncCallDepth = 2
bl.loggerFuncCallDepth = 3
bl.msgChanLen = append(channelLens, 0)[0]
if bl.msgChanLen <= 0 {
bl.msgChanLen = defaultAsyncMsgLen

6
scripts/adapter.sh Normal file
View File

@ -0,0 +1,6 @@
#!/bin/sh
# using pkg/adapter. Usually you want to migrate to V2 smoothly, you could running this script
find ./ -name '*.go' -type f -exec sed -i '' -e 's/github.com\/astaxie\/beego/github.com\/astaxie\/beego\/pkg\/adapter/g' {} \;
find ./ -name '*.go' -type f -exec sed -i '' -e 's/"github.com\/astaxie\/beego\/pkg\/adapter"/beego "github.com\/astaxie\/beego\/pkg\/adapter"/g' {} \;