refactor:调整日志级别并优化代码

-将数据库日志级别从 Info降低到 Warn,减少不必要的日志输出
- 注释掉股票数据存在时的 Info 级别日志,降低日志冗余
This commit is contained in:
ArvinLovegood 2025-04-01 16:12:11 +08:00
parent 5096bfac68
commit 9ebb246e5c
2 changed files with 3 additions and 3 deletions

View File

@ -20,7 +20,7 @@ func Init(sqlitePath string) {
Colorful: false,
IgnoreRecordNotFoundError: true,
ParameterizedQueries: false,
LogLevel: logger.Info,
LogLevel: logger.Warn,
},
)
var openDb *gorm.DB

View File

@ -216,7 +216,7 @@ func initStockDataUS() {
var count int64
db.Dao.Model(&models.StockInfoUS{}).Where("code = ?", item.Code).Count(&count)
if count > 0 {
log.SugaredLogger.Infof("stock data us %s exist", item.Code)
//log.SugaredLogger.Infof("stock data us %s exist", item.Code)
continue
}
db.Dao.Model(&models.StockInfoUS{}).Create(&item)
@ -235,7 +235,7 @@ func initStockDataHK() {
var count int64
db.Dao.Model(&models.StockInfoHK{}).Where("code = ?", item.Code).Count(&count)
if count > 0 {
log.SugaredLogger.Infof("stock data hk %s exist", item.Code)
//log.SugaredLogger.Infof("stock data hk %s exist", item.Code)
continue
}
db.Dao.Model(&models.StockInfoHK{}).Create(&item)