Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
guo450212436
et
提交
f6d95742
E
et
项目概览
guo450212436
/
et
与 Fork 源项目一致
从无法访问的项目Fork
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
E
et
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
f6d95742
编写于
11月 29, 2018
作者:
T
tanghai
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
增加延迟构造log,建议使用,防止开启不同级别的log仍然构建字符串产生gc
上级
1014fe1f
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
128 addition
and
114 deletion
+128
-114
Server/Model/Base/Logger/ALogDecorater.cs
Server/Model/Base/Logger/ALogDecorater.cs
+0
-40
Server/Model/Base/Logger/ILog.cs
Server/Model/Base/Logger/ILog.cs
+6
-0
Server/Model/Base/Logger/NLogAdapter.cs
Server/Model/Base/Logger/NLogAdapter.cs
+38
-12
Server/Model/Base/Logger/StackInfoDecorater.cs
Server/Model/Base/Logger/StackInfoDecorater.cs
+0
-47
Unity/Assets/Hotfix/Base/Log.cs
Unity/Assets/Hotfix/Base/Log.cs
+35
-1
Unity/Assets/Model/Base/Log.cs
Unity/Assets/Model/Base/Log.cs
+43
-8
Unity/Unity.sln
Unity/Unity.sln
+6
-6
未找到文件。
Server/Model/Base/Logger/ALogDecorater.cs
已删除
100644 → 0
浏览文件 @
1014fe1f
namespace
ETModel
{
public
abstract
class
ALogDecorater
{
protected
const
string
SEP
=
" "
;
private
int
level
;
protected
readonly
ALogDecorater
decorater
;
protected
ALogDecorater
(
ALogDecorater
decorater
=
null
)
{
this
.
decorater
=
decorater
;
this
.
Level
=
0
;
}
protected
int
Level
{
get
{
return
this
.
level
;
}
set
{
this
.
level
=
value
;
if
(
this
.
decorater
!=
null
)
{
this
.
decorater
.
Level
=
value
+
1
;
}
}
}
public
virtual
string
Decorate
(
string
message
)
{
if
(
this
.
decorater
==
null
)
{
return
message
;
}
return
this
.
decorater
.
Decorate
(
message
);
}
}
}
\ No newline at end of file
Server/Model/Base/Logger/ILog.cs
浏览文件 @
f6d95742
...
...
@@ -8,5 +8,11 @@
void
Debug
(
string
message
);
void
Error
(
string
message
);
void
Fatal
(
string
message
);
void
Trace
(
string
message
,
params
object
[]
args
);
void
Warning
(
string
message
,
params
object
[]
args
);
void
Info
(
string
message
,
params
object
[]
args
);
void
Debug
(
string
message
,
params
object
[]
args
);
void
Error
(
string
message
,
params
object
[]
args
);
void
Fatal
(
string
message
,
params
object
[]
args
);
}
}
\ No newline at end of file
Server/Model/Base/Logger/NLogAdapter.cs
浏览文件 @
f6d95742
...
...
@@ -2,42 +2,68 @@
namespace
ETModel
{
public
class
NLogAdapter
:
ALogDecorater
,
ILog
public
class
NLogAdapter
:
ILog
{
private
readonly
Logger
logger
=
LogManager
.
GetLogger
(
"Logger"
);
public
NLogAdapter
(
ALogDecorater
decorater
=
null
):
base
(
decorater
)
{
}
public
void
Trace
(
string
message
)
{
this
.
logger
.
Trace
(
this
.
Decorate
(
message
)
);
this
.
logger
.
Trace
(
message
);
}
public
void
Warning
(
string
message
)
{
this
.
logger
.
Warn
(
this
.
Decorate
(
message
)
);
this
.
logger
.
Warn
(
message
);
}
public
void
Info
(
string
message
)
{
this
.
logger
.
Info
(
this
.
Decorate
(
message
)
);
this
.
logger
.
Info
(
message
);
}
public
void
Debug
(
string
message
)
{
this
.
logger
.
Debug
(
this
.
Decorate
(
message
)
);
this
.
logger
.
Debug
(
message
);
}
public
void
Error
(
string
message
)
{
this
.
logger
.
Error
(
this
.
Decorate
(
message
)
);
this
.
logger
.
Error
(
message
);
}
public
void
Fatal
(
string
message
)
{
this
.
logger
.
Fatal
(
this
.
Decorate
(
message
)
);
this
.
logger
.
Fatal
(
message
);
}
}
public
void
Trace
(
string
message
,
params
object
[]
args
)
{
this
.
logger
.
Trace
(
message
,
args
);
}
public
void
Warning
(
string
message
,
params
object
[]
args
)
{
this
.
logger
.
Warn
(
message
,
args
);
}
public
void
Info
(
string
message
,
params
object
[]
args
)
{
this
.
logger
.
Info
(
message
,
args
);
}
public
void
Debug
(
string
message
,
params
object
[]
args
)
{
this
.
logger
.
Debug
(
message
,
args
);
}
public
void
Error
(
string
message
,
params
object
[]
args
)
{
this
.
logger
.
Error
(
message
,
args
);
}
public
void
Fatal
(
string
message
,
params
object
[]
args
)
{
this
.
logger
.
Fatal
(
message
,
args
);
}
}
}
\ No newline at end of file
Server/Model/Base/Logger/StackInfoDecorater.cs
已删除
100644 → 0
浏览文件 @
1014fe1f
using
System.Diagnostics
;
using
System.IO
;
namespace
ETModel
{
internal
class
StackInfoDecorater
:
ALogDecorater
{
public
StackInfoDecorater
(
ALogDecorater
decorater
=
null
):
base
(
decorater
)
{
this
.
FileName
=
true
;
this
.
FileLineNumber
=
true
;
}
public
bool
FileName
{
get
;
set
;
}
public
bool
FileLineNumber
{
get
;
set
;
}
public
override
string
Decorate
(
string
message
)
{
if
(
this
.
decorater
!=
null
)
{
message
=
this
.
decorater
.
Decorate
(
message
);
}
if
(!
this
.
FileLineNumber
&&
!
this
.
FileName
)
{
return
message
;
}
string
extraInfo
=
""
;
StackTrace
stackTrace
=
new
StackTrace
(
true
);
StackFrame
frame
=
stackTrace
.
GetFrame
(
this
.
Level
+
3
);
if
(
this
.
FileName
)
{
string
fileName
=
Path
.
GetFileName
(
frame
.
GetFileName
());
extraInfo
+=
fileName
+
" "
;
}
if
(
this
.
FileLineNumber
)
{
int
fileLineNumber
=
frame
.
GetFileLineNumber
();
extraInfo
+=
fileLineNumber
+
" "
;
}
return
extraInfo
+
message
;
}
}
}
\ No newline at end of file
Unity/Assets/Hotfix/Base/Log.cs
浏览文件 @
f6d95742
...
...
@@ -4,6 +4,11 @@ namespace ETHotfix
{
public
static
class
Log
{
public
static
void
Trace
(
string
msg
)
{
ETModel
.
Log
.
Trace
(
msg
);
}
public
static
void
Warning
(
string
msg
)
{
ETModel
.
Log
.
Warning
(
msg
);
...
...
@@ -29,9 +34,38 @@ namespace ETHotfix
ETModel
.
Log
.
Debug
(
msg
);
}
public
static
void
Trace
(
string
message
,
params
object
[]
args
)
{
ETModel
.
Log
.
Trace
(
message
,
args
);
}
public
static
void
Warning
(
string
message
,
params
object
[]
args
)
{
ETModel
.
Log
.
Warning
(
message
,
args
);
}
public
static
void
Info
(
string
message
,
params
object
[]
args
)
{
ETModel
.
Log
.
Info
(
message
,
args
);
}
public
static
void
Debug
(
string
message
,
params
object
[]
args
)
{
ETModel
.
Log
.
Debug
(
message
,
args
);
}
public
static
void
Error
(
string
message
,
params
object
[]
args
)
{
ETModel
.
Log
.
Error
(
message
,
args
);
}
public
static
void
Fatal
(
string
message
,
params
object
[]
args
)
{
ETModel
.
Log
.
Fatal
(
message
,
args
);
}
public
static
void
Msg
(
object
msg
)
{
Debug
(
Dumper
.
DumpAsString
(
msg
));
}
}
...
...
Unity/Assets/Model/Base/Log.cs
浏览文件 @
f6d95742
...
...
@@ -8,30 +8,65 @@ namespace ETModel
{
UnityEngine
.
Debug
.
Log
(
msg
);
}
public
static
void
Warnin
g
(
string
msg
)
public
static
void
Debu
g
(
string
msg
)
{
UnityEngine
.
Debug
.
Log
Warning
(
msg
);
UnityEngine
.
Debug
.
Log
(
msg
);
}
public
static
void
Info
(
string
msg
)
{
UnityEngine
.
Debug
.
Log
(
msg
);
}
public
static
void
Error
(
Exception
e
)
public
static
void
Warning
(
string
msg
)
{
UnityEngine
.
Debug
.
Log
Error
(
e
.
ToString
()
);
UnityEngine
.
Debug
.
Log
Warning
(
msg
);
}
public
static
void
Error
(
string
msg
)
{
UnityEngine
.
Debug
.
LogError
(
msg
);
}
public
static
void
Error
(
Exception
e
)
{
UnityEngine
.
Debug
.
LogException
(
e
);
}
public
static
void
Debug
(
string
msg
)
public
static
void
Fatal
(
string
msg
)
{
UnityEngine
.
Debug
.
Log
(
msg
);
UnityEngine
.
Debug
.
LogAssertion
(
msg
);
}
public
static
void
Trace
(
string
message
,
params
object
[]
args
)
{
UnityEngine
.
Debug
.
LogFormat
(
message
,
args
);
}
public
static
void
Warning
(
string
message
,
params
object
[]
args
)
{
UnityEngine
.
Debug
.
LogWarningFormat
(
message
,
args
);
}
public
static
void
Info
(
string
message
,
params
object
[]
args
)
{
UnityEngine
.
Debug
.
LogFormat
(
message
,
args
);
}
public
static
void
Debug
(
string
message
,
params
object
[]
args
)
{
UnityEngine
.
Debug
.
LogFormat
(
message
,
args
);
}
public
static
void
Error
(
string
message
,
params
object
[]
args
)
{
UnityEngine
.
Debug
.
LogErrorFormat
(
message
,
args
);
}
public
static
void
Fatal
(
string
message
,
params
object
[]
args
)
{
UnityEngine
.
Debug
.
LogAssertionFormat
(
message
,
args
);
}
public
static
void
Msg
(
object
msg
)
...
...
Unity/Unity.sln
浏览文件 @
f6d95742
...
...
@@ -4,10 +4,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Unity.Model", "Unity.Model.
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Unity.ThirdParty", "Unity.ThirdParty.csproj", "{E15BADD2-3A26-309A-AB0F-DC5B08044350}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Unity.Editor", "Unity.Editor.csproj", "{CD311104-1830-B119-81B6-5DBEE2467FFB}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Unity.Hotfix", "Unity.Hotfix.csproj", "{1066F652-6A89-D1C4-9881-1A19DF7AB80E}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Unity.Editor", "Unity.Editor.csproj", "{CD311104-1830-B119-81B6-5DBEE2467FFB}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
...
...
@@ -22,14 +22,14 @@ Global
{E15BADD2-3A26-309A-AB0F-DC5B08044350}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E15BADD2-3A26-309A-AB0F-DC5B08044350}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E15BADD2-3A26-309A-AB0F-DC5B08044350}.Release|Any CPU.Build.0 = Release|Any CPU
{CD311104-1830-B119-81B6-5DBEE2467FFB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CD311104-1830-B119-81B6-5DBEE2467FFB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CD311104-1830-B119-81B6-5DBEE2467FFB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CD311104-1830-B119-81B6-5DBEE2467FFB}.Release|Any CPU.Build.0 = Release|Any CPU
{1066F652-6A89-D1C4-9881-1A19DF7AB80E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1066F652-6A89-D1C4-9881-1A19DF7AB80E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1066F652-6A89-D1C4-9881-1A19DF7AB80E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1066F652-6A89-D1C4-9881-1A19DF7AB80E}.Release|Any CPU.Build.0 = Release|Any CPU
{CD311104-1830-B119-81B6-5DBEE2467FFB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CD311104-1830-B119-81B6-5DBEE2467FFB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CD311104-1830-B119-81B6-5DBEE2467FFB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CD311104-1830-B119-81B6-5DBEE2467FFB}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录