4.5、Libgdx运行日志管理

时间:2023-03-09 23:16:31
4.5、Libgdx运行日志管理
Application接口提供了简单的管理日志的方法。
日志的消息可以是info、error和debug。格式如下:
Gdx.app.log("MyTag", "my informative
message");

Gdx.app.error("MyTag", "my error message", exception);

Gdx.app.debug("MyTag", "my debug message");
在Android中,日志将输出到logcat中。
可以通过以下方法设置日志的级别:
Gdx.app.setLogLevel(logLevel);
logLevel可以是以下值:
  • Application.LOG_NONE:停止记录所有消息。
  • Application.LOG_DEBUG:记录所有消息。
  • Application.LOG_ERROR:只记录错误消息。
  • Application.LOG_INFO:记录错误和政策消息。
www.libgdx.cn版权所有,如需转载,注明出处)