本文整理汇总了Java中cn.nukkit.utils.LogLevel类的典型用法代码示例。如果您正苦于以下问题:Java LogLevel类的具体用法?Java LogLevel怎么用?Java LogLevel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LogLevel类属于cn.nukkit.utils包,在下文中一共展示了LogLevel类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: publish
import cn.nukkit.utils.LogLevel; //导入依赖的package包/类
@Override
public void publish(LogRecord record) {
String message = record.getMessage();
LogLevel level = toNukkitLevel(record.getLevel());
if (level == null) {
return;
}
Throwable thrown = record.getThrown();
if (thrown == null) {
nukkit.log(level, message);
} else {
nukkit.log(level, message, thrown);
}
}
示例2: toNukkitLevel
import cn.nukkit.utils.LogLevel; //导入依赖的package包/类
private LogLevel toNukkitLevel(Level level) {
if (level == Level.SEVERE) {
return LogLevel.ERROR;
}
if (level == Level.WARNING) {
return LogLevel.WARNING;
}
if (level == Level.INFO) {
return LogLevel.INFO;
}
if (level == Level.CONFIG || level == Level.FINE) {
return LogLevel.DEBUG;
}
return null;
}
示例3: start
import cn.nukkit.utils.LogLevel; //导入依赖的package包/类
/**
* Start measuring statistics. This will immediately create an async repeating task as the plugin and send the
* initial data to the metrics backend, and then after that it will post in increments of PING_INTERVAL * 1200
* ticks.
*
* @return True if statistics measuring is running, otherwise false.
*/
public boolean start() {
// Is metrics already running?
if (this.taskId != -1) {
return true;
}
// Begin hitting the server with glorious data
this.taskId = TaskManager.IMP.repeatAsync(new Runnable() {
private boolean firstPost = true;
@Override
public void run() {
try {
postPlugin(!this.firstPost);
// After the first post we set firstPost to
// false
// Each post thereafter will be a ping
this.firstPost = false;
} catch (IOException e) {
MainUtil.handleError(e);
if (Metrics.this.debug) {
plugin.getLogger().log(LogLevel.INFO, "[Metrics] " + e.getMessage());
}
}
}
}, PING_INTERVAL * 1200);
return true;
}
示例4: start
import cn.nukkit.utils.LogLevel; //导入依赖的package包/类
/**
* Start measuring statistics. This will immediately create an async repeating task as the plugin and send the
* initial data to the metrics backend, and then after that it will post in increments of PING_INTERVAL * 1200
* ticks.
*
* @return True if statistics measuring is running, otherwise false.
*/
public boolean start() {
// Is metrics already running?
if (this.taskId != -1) {
return true;
}
// Begin hitting the server with glorious data
this.taskId = TaskManager.IMP.taskRepeatAsync(new Runnable() {
private boolean firstPost = true;
@Override
public void run() {
try {
postPlugin(!this.firstPost);
// After the first post we set firstPost to
// false
// Each post thereafter will be a ping
this.firstPost = false;
} catch (IOException e) {
e.printStackTrace();
if (Metrics.this.debug) {
plugin.getLogger().log(LogLevel.INFO, "[Metrics] " + e.getMessage());
}
}
}
}, PING_INTERVAL * 1200);
return true;
}
示例5: emergency
import cn.nukkit.utils.LogLevel; //导入依赖的package包/类
@Override
public void emergency(String message) {
this.log(LogLevel.EMERGENCY, message);
}
示例6: alert
import cn.nukkit.utils.LogLevel; //导入依赖的package包/类
@Override
public void alert(String message) {
this.log(LogLevel.ALERT, message);
}
示例7: critical
import cn.nukkit.utils.LogLevel; //导入依赖的package包/类
@Override
public void critical(String message) {
this.log(LogLevel.CRITICAL, message);
}
示例8: error
import cn.nukkit.utils.LogLevel; //导入依赖的package包/类
@Override
public void error(String message) {
this.log(LogLevel.ERROR, message);
}
示例9: warning
import cn.nukkit.utils.LogLevel; //导入依赖的package包/类
@Override
public void warning(String message) {
this.log(LogLevel.WARNING, message);
}
示例10: notice
import cn.nukkit.utils.LogLevel; //导入依赖的package包/类
@Override
public void notice(String message) {
this.log(LogLevel.NOTICE, message);
}
示例11: info
import cn.nukkit.utils.LogLevel; //导入依赖的package包/类
@Override
public void info(String message) {
this.log(LogLevel.INFO, message);
}
示例12: debug
import cn.nukkit.utils.LogLevel; //导入依赖的package包/类
@Override
public void debug(String message) {
this.log(LogLevel.DEBUG, message);
}
示例13: log
import cn.nukkit.utils.LogLevel; //导入依赖的package包/类
@Override
public void log(LogLevel level, String message) {
Server.getInstance().getLogger().log(level, this.pluginName + message);
}