Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1. 增加日志打印及日志等级可配; 2. 修复数据库编码为latin1时提交中文名作业失败的问题 #18

Merged
merged 1 commit into from
Sep 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
gen
gen
.idea
11 changes: 10 additions & 1 deletion caller/caller.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,16 @@ func initLogger() {
// 设置日志输出格式为JSON
Logger.SetFormatter(&LogFormatter{})
// 设置日志级别为Info
Logger.SetLevel(logrus.InfoLevel)
switch ConfigValue.LogConfig.Level {
case "info":
Logger.SetLevel(logrus.InfoLevel)
case "debug":
Logger.SetLevel(logrus.DebugLevel)
case "trace":
Logger.SetLevel(logrus.TraceLevel)
default:
Logger.SetLevel(logrus.InfoLevel)
}

// 创建一个 lumberjack.Logger,用于日志轮转配置
logFile := &lumberjack.Logger{
Expand Down
3 changes: 3 additions & 0 deletions config/config.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
log:
level: "info"

# slurm 数据库配置
mysql:
host: 127.0.0.1
Expand Down
Loading
Loading