Ver Fonte

no message

xingzai há 5 meses atrás
pai
commit
550904200f
1 ficheiros alterados com 27 adições e 13 exclusões
  1. 27 13
      utils/config.go

+ 27 - 13
utils/config.go

@@ -4,6 +4,7 @@ import (
 	"fmt"
 	"github.com/beego/beego/v2/server/web"
 	"github.com/rdlucklib/rdluck_tools/cache"
+	"strconv"
 )
 
 var (
@@ -75,6 +76,19 @@ var (
 	WxMsgCategoryTemplateIdAddMessage                string //专栏文章留言-类目模板ID
 )
 
+// 日志配置
+var (
+	LogPath     string //调用过程中的日志存放地址
+	LogFile     string
+	LogDataPath string //调用过程中图表相关的日志存放地址
+	LogDataFile string
+	BinLogPath  string //数据库相关的日志存放地址
+	BinLogFile  string
+	ApiLogPath  string //接口请求地址和接口返回值日志存放地址
+	ApiLogFile  string
+	LogMaxDays  int //日志最大保留天数
+)
+
 func init() {
 	tmpRunMode, err := web.AppConfig.String("run_mode")
 	if err != nil {
@@ -189,6 +203,19 @@ func init() {
 	}
 	HeadimgurlDefault = "https://hongze.oss-cn-shanghai.aliyuncs.com/static/images/202202/20220225/XFBBOUmDC5AXkfxnHiuqKpPtoofH.png"
 
+	//日志配置
+	{
+		LogPath = config["log_path"]
+		LogFile = config["log_file"]
+		LogDataPath = config["log_data_path"]
+		LogDataFile = config["log_data_file"]
+		BinLogPath = config["binlog_path"]
+		BinLogFile = config["binlog_file"]
+		ApiLogPath = config["apilog_path"]
+		ApiLogFile = config["apilog_file"]
+		logMaxDaysStr := config["log_max_day"]
+		LogMaxDays, _ = strconv.Atoi(logMaxDaysStr)
+	}
 	//易董开放api配置
 	YiDongApiConfig()
 }
@@ -213,16 +240,3 @@ func YiDongApiConfig() {
 //http://webapi.brilliantstart.cn/api/
 //http://webapi.brilliantstart.cn/swagger/
 //http://139.196.122.219:8603/swagger/
-
-// 日志配置
-var (
-	LogPath     string //调用过程中的日志存放地址
-	LogFile     string
-	LogDataPath string //调用过程中图表相关的日志存放地址
-	LogDataFile string
-	BinLogPath  string //数据库相关的日志存放地址
-	BinLogFile  string
-	ApiLogPath  string //接口请求地址和接口返回值日志存放地址
-	ApiLogFile  string
-	LogMaxDays  int //日志最大保留天数
-)