This commit is contained in:
Sun
2023-11-08 21:53:07 +08:00
commit 211c3071dc
245 changed files with 39293 additions and 0 deletions
+26
View File
@@ -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
}