v1.0.0
This commit is contained in:
commit
211c3071dc
245 files changed
+39293
No files matched your search
@@ -0,0 +1,26 @@
|
||||
package runlog
|
||||
|
||||
import (
|
||||
"os"
|
||||
"sun-panel/global"
|
||||
"sun-panel/lib/cmn"
|
||||
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
func InitRunlog(runmode string, filePath string) (*zap.SugaredLogger, error) {
|
||||
|
||||
runtimePath := "./runtime/runlog"
|
||||
if err := os.MkdirAll(runtimePath, 0777); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
var level zap.AtomicLevel
|
||||
if runmode == "debug" {
|
||||
level = zap.NewAtomicLevelAt(zap.DebugLevel)
|
||||
} else {
|
||||
level = global.LoggerLevel
|
||||
}
|
||||
|
||||
logger := cmn.InitLogger(runtimePath+"/"+filePath, level)
|
||||
return logger, nil
|
||||
}
|
||||
Reference in new issue
Block a user