提交 ea7e1177 编写于 作者: T tanghai

1.终于找到log 文件行号显示不准的问题了,原来是用了Release

2.格式化一下log,更好看一点
上级 8d33d1e7
......@@ -7,28 +7,28 @@
<target name="all" xsi:type="File"
fileName="${basedir}/../Logs/Log.txt"
deleteOldFileOnStartup="false"
layout="${longdate} ${var:appType} ${var:appId} ${callsite:className=false:methodName=false:fileName=true:includeSourcePath=false:skipFrames=1} ${message}" />
layout="${longdate} ${var:appTypeFormat} ${var:appIdFormat} ${callsite:className=false:methodName=false:fileName=true:includeSourcePath=false:skipFrames=2} ${message}" />
</targets>
<targets>
<target name="debug" xsi:type="File"
fileName="${basedir}/../Logs/Log-${var:appType}-${var:appId}-Debug.txt"
deleteOldFileOnStartup="false"
layout="${longdate} ${var:appType} ${var:appId} ${callsite:className=false:methodName=false:fileName=true:includeSourcePath=false:skipFrames=1} ${message} ${stacktrace:format=Flat:topFrames=100:skipFrames=0}" />
layout="${longdate} ${var:appTypeFormat} ${var:appIdFormat} ${callsite:className=false:methodName=false:fileName=true:includeSourcePath=false:skipFrames=2} ${message} ${stacktrace:format=Flat:topFrames=100:skipFrames=0}" />
</targets>
<targets>
<target name="info" xsi:type="File"
fileName="${basedir}/../Logs/Log-${var:appType}-${var:appId}-Info.txt"
deleteOldFileOnStartup="false"
layout="${longdate} ${var:appType} ${var:appId} ${callsite:className=false:methodName=false:fileName=true:includeSourcePath=false:skipFrames=1} ${message}" />
layout="${longdate} ${var:appTypeFormat} ${var:appIdFormat} ${callsite:className=false:methodName=false:fileName=true:includeSourcePath=false:skipFrames=2} ${message}" />
</targets>
<targets>
<target name="error" xsi:type="File"
fileName="${basedir}/../Logs/Log-${var:appType}-${var:appId}-Error.txt"
deleteOldFileOnStartup="false"
layout="${longdate} ${var:appType} ${var:appId} ${callsite:className=false:methodName=false:fileName=true:includeSourcePath=false:skipFrames=1} ${message} ${stacktrace:format=Flat:topFrames=100:skipFrames=0}" />
layout="${longdate} ${var:appTypeFormat} ${var:appIdFormat} ${callsite:className=false:methodName=false:fileName=true:includeSourcePath=false:skipFrames=2} ${message} ${stacktrace:format=Flat:topFrames=100:skipFrames=0}" />
</targets>
<rules>
......
......@@ -31,6 +31,8 @@ namespace App
LogManager.Configuration.Variables["appType"] = startConfig.AppType.ToString();
LogManager.Configuration.Variables["appId"] = startConfig.AppId.ToString();
LogManager.Configuration.Variables["appTypeFormat"] = $"{startConfig.AppType,-8}";
LogManager.Configuration.Variables["appIdFormat"] = $"{startConfig.AppId:D3}";
Log.Info("server start........................");
......
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
namespace Model
{
......@@ -15,8 +16,6 @@ namespace Model
public class StartConfigComponent: Component
{
private List<StartConfig> allConfigs;
private Dictionary<int, StartConfig> configDict;
public StartConfig StartConfig { get; private set; }
......@@ -33,7 +32,6 @@ namespace Model
public void Awake(string path, int appId)
{
this.allConfigs = new List<StartConfig>();
this.configDict = new Dictionary<int, StartConfig>();
this.MapConfigs = new List<StartConfig>();
this.GateConfigs = new List<StartConfig>();
......@@ -49,7 +47,6 @@ namespace Model
try
{
StartConfig startConfig = MongoHelper.FromJson<StartConfig>(s2);
this.allConfigs.Add(startConfig);
this.configDict.Add(startConfig.AppId, startConfig);
if (startConfig.AppType.Is(AppType.Realm))
......@@ -100,14 +97,14 @@ namespace Model
public StartConfig[] GetAll()
{
return this.allConfigs.ToArray();
return this.configDict.Values.ToArray();
}
public int Count
{
get
{
return this.allConfigs.Count;
return this.configDict.Count;
}
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册