clean: remove deprecated utils/ package
- Remove all 5 files from utils/ (serial.go, socket.go, pulsar.go, sqlite.go, telegram.go) - cmd/root.go: remove utils import and all utils. references - cmd/test.go: rewrite to use serial, storage, transport packages directly with proper error logging via zap
This commit is contained in:
+1
-14
@@ -26,7 +26,6 @@ import (
|
||||
"go.uber.org/zap/zapcore"
|
||||
|
||||
"it2000.com.cn/tele-recv/config"
|
||||
"it2000.com.cn/tele-recv/utils"
|
||||
)
|
||||
|
||||
const ModeName = "TELEGRAM_MODE"
|
||||
@@ -77,7 +76,6 @@ func init() {
|
||||
rootCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle")
|
||||
|
||||
initLog()
|
||||
utils.Log = logger
|
||||
}
|
||||
|
||||
// initConfig reads in config file and ENV variables if set.
|
||||
@@ -89,7 +87,7 @@ func initConfig() {
|
||||
}
|
||||
appCfg = cfg
|
||||
|
||||
// Populate legacy globals for backward compatibility
|
||||
// Populate legacy globals
|
||||
device = cfg.Serial.Device
|
||||
baudrate = cfg.Serial.Baudrate
|
||||
lograw = cfg.Serial.LogRaw
|
||||
@@ -101,8 +99,6 @@ func initConfig() {
|
||||
name = cfg.Pulsar.Name
|
||||
tcp = cfg.Telegram.TCP
|
||||
pulsar = cfg.Telegram.Pulsar
|
||||
utils.Tcp = tcp
|
||||
utils.Pulsar = pulsar
|
||||
}
|
||||
|
||||
func initLog() {
|
||||
@@ -115,15 +111,6 @@ func initLog() {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
rawFile := "./logs/raw-%Y-%m-%d-%H.txt"
|
||||
utils.RawLog, err = rotatelogs.New(
|
||||
rawFile,
|
||||
rotatelogs.WithMaxAge(60*24*time.Hour),
|
||||
rotatelogs.WithRotationTime(time.Hour))
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
filePriority := zap.LevelEnablerFunc(func(lvl zapcore.Level) bool {
|
||||
return lvl >= zapcore.DebugLevel
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user