libgdx Logging (日志)

来源:互联网 发布:纽昂司软件成都分公司 编辑:程序博客网 时间:2024/05/18 21:47
Application借口提供了简单的日志工具。
一条消息可以是一个普通的信息消息、一个有可选异常错误消息、或者一个调试消息。
Gdx.app.log("MyTag", "my informative message");Gdx.app.error("MyTag", "my error message", exception);Gdx.app.debug("MyTag", "my debug message");
根据平台的不同,消息会被输出在控制台(桌面应用)、logCat(Android应用)、或者一个在GwtApplicationConfiguration提供的GWT(textArea)、或者自动创建(html5)。
日志能够被限制成一个指定的日志等级。
Gdx.app.setLogLevel(logLevel);
logLevel可以使如下几个值:
  • Application.LOG_NONE: mutes all logging. 不显示
  • Application.LOG_DEBUG: logs all messages. 显示所有消息
  • Application.LOG_ERROR: logs only error messages. 只显示错误消息
  • Application.LOG_INFO: logs error and normal messages. 显示错误和信息消息
0 0
原创粉丝点击