From a335f66c4c520728be640ca4e7029ce6f45b8f3d Mon Sep 17 00:00:00 2001 From: zhangzengfei <zhangzengfei@smartai.com> Date: 星期五, 11 八月 2023 11:21:32 +0800 Subject: [PATCH] web 接口添加token --- main.go | 20 +++++++++++++++++++- 1 files changed, 19 insertions(+), 1 deletions(-) diff --git a/main.go b/main.go index fea16d5..a828d4b 100644 --- a/main.go +++ b/main.go @@ -1,12 +1,18 @@ package main import ( + "plc-recorder/msg" + "runtime" + + "plc-recorder/collector" "plc-recorder/config" "plc-recorder/logger" "plc-recorder/nsqclient" "github.com/rs/zerolog" ) + +var logFilePath = "./log/plc-recorder.log" func main() { // 鍒濆鍖栭厤缃� @@ -16,11 +22,23 @@ zerolog.SetGlobalLevel(zerolog.FatalLevel) // 鍒濆鍖栨棩蹇� - logger.InitLog("./log/plc-recorder.log", "debug", 15, false) + if runtime.GOOS == "windows" { + logFilePath = "log/plc-recorder.log" + } + + logger.InitLog(logFilePath, "debug", 15, false) logger.Info("plc-recorde start!") // 鍒濆鍖杗sq nsqclient.InitNsqProducer() + // 璁㈤槄璁惧鍙樻洿 + go nsqclient.InitNsqConsumer(config.Options.SubDeviceTopic, "plc-recorder", collector.HandleDeviceUpdate) + + collector.InitTask() + + // 娴嬭瘯鏁版嵁 + go msg.TestSendDeviceLiveData() + select {} } -- Gitblit v1.8.0