Localization and enhancement of Binance service logs

This commit is contained in:
wood chen 2024-10-20 21:56:18 +08:00
parent 112c024bd2
commit 9c116036c9
2 changed files with 7 additions and 3 deletions

View File

@ -111,7 +111,7 @@ func sendPriceUpdate() {
} }
func RunBinance() { func RunBinance() {
logger.Println("Starting Binance service...") logger.Println("启动币安服务...")
// 初始化必要的变量 // 初始化必要的变量
botToken = core.BOT_TOKEN botToken = core.BOT_TOKEN
@ -122,11 +122,12 @@ func RunBinance() {
// 初始化并加载所有交易对 // 初始化并加载所有交易对
if err := LoadAllSymbols(); err != nil { if err := LoadAllSymbols(); err != nil {
logger.Fatalf("Failed to load all trading pairs: %v", err) logger.Fatalf("加载所有交易对失败: %v", err)
} }
// 启动每小时刷新交易对缓存 // 启动每小时刷新交易对缓存
go StartSymbolRefresh(1 * time.Hour) go StartSymbolRefresh(1 * time.Hour)
logger.Println("启动每小时刷新交易对缓存...")
// 立即发送一次价格更新 // 立即发送一次价格更新
sendPriceUpdate() sendPriceUpdate()
@ -137,7 +138,7 @@ func RunBinance() {
for range ticker.C { for range ticker.C {
now := time.Now().In(singaporeTZ) now := time.Now().In(singaporeTZ)
if now.Minute() == 0 { if now.Minute() == 0 {
logger.Println("Sending hourly price update...") logger.Println("发送每小时价格更新...")
sendPriceUpdate() sendPriceUpdate()
} }
} }

View File

@ -8,7 +8,10 @@ import (
) )
func StartScheduledTasks() { func StartScheduledTasks() {
log.Printf("启动定时任务")
go periodicCleanup() go periodicCleanup()
log.Printf("过期链接清理任务已启动")
} }
func periodicCleanup() { func periodicCleanup() {