UE4游戏探讨

UE4日志级别设置

2019-05-08  本文已影响0人  狼图腾_094d

1. UE4日志级别设置

1.1. 日志级别分类

每个日志等级详细程度被四个部分控制:Compile-time verbosity(编译时详细程度), default verbosity(默认详细程度), ini verbosity(ini配置详细程度), runtime-verbosity(运行时详细程度).

启动时,默认的编译时详细程度被ini配置详细程度覆盖,ini配置被命令行覆盖。

具体配置和命令见下面的各个说明。

1.2. Log conventions (in the console, ini files, or environment variables)

At boot time, compiled in default is overridden by ini files setting, which is overridden by command line

1.3. Log console command usage

1.4. Log command line

-LogCmds=\"[arguments],[arguments]...\"           - applies a list of console commands at boot time
-LogCmds=\"foo verbose, bar off\"         - turns on the foo category and turns off the bar category

1.5. Environment variables

Any command line option can be set via the environment variable UE-CmdLineArgs

set UE-CmdLineArgs=\"-LogCmds=foo verbose breakon, bar off\"

1.6. Config file

In DefaultEngine.ini or Engine.ini:

[Core.Log]
global=[default verbosity for things not listed later]
[cat]=[level]
foo=verbose break

对于不同的系统,你可以设置不同的默认等级,这样可以在调试的时候,将某个类型的某些等级的日志打开,方便调试,正常的情况下默认关闭这些日志等级的输出。具体代码示例如下:

  //显示所有日志语句。
 DECLARE_LOG_CATEGORY_EXTERN ( LogMyGameSomeSystem , Log , All );

 //不会显示VeryVerbose语句。
 DECLARE_LOG_CATEGORY_EXTERN ( LogMyGameSomeSystem , Verbose , All );

 //不会显示VeryVerbose和Verbose语句。
 DECLARE_LOG_CATEGORY_EXTERN ( LogMyGameSomeSystem , VeryVerbose , All );

每个游戏可以根据需要对不同系统创建不同类型的日志,这样方便调试的时候打开某些系统的某些等级的日志,以方便定位问题。

参考链接:

https://wiki.unrealengine.com/Logs,_Printing_Messages_To_Yourself_During_Runtime

https://answers.unrealengine.com/questions/78413/ue-log-not-changing-logging-level.html

上一篇 下一篇

猜你喜欢

热点阅读