mirror of
https://github.com/ArvinLovegood/go-stock.git
synced 2025-07-19 00:00:09 +08:00
refactor:调整日志级别并优化代码
-将数据库日志级别从 Info降低到 Warn,减少不必要的日志输出 - 注释掉股票数据存在时的 Info 级别日志,降低日志冗余
This commit is contained in:
parent
5096bfac68
commit
9ebb246e5c
@ -20,7 +20,7 @@ func Init(sqlitePath string) {
|
||||
Colorful: false,
|
||||
IgnoreRecordNotFoundError: true,
|
||||
ParameterizedQueries: false,
|
||||
LogLevel: logger.Info,
|
||||
LogLevel: logger.Warn,
|
||||
},
|
||||
)
|
||||
var openDb *gorm.DB
|
||||
|
4
main.go
4
main.go
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user