Java Code Examples for org.apache.logging.log4j.Level#name()
The following examples show how to use
org.apache.logging.log4j.Level#name() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JdaFilter.java From DiscordSRV with GNU General Public License v3.0 | 6 votes |
public Result check(String loggerName, Level level, String message, Throwable throwable) { // only listen for JDA logs if (!loggerName.startsWith("github.scarsz.discordsrv.dependencies.jda")) return Result.NEUTRAL; switch (level.name()) { case "INFO": DiscordSRV.info("[JDA] " + message); break; case "WARN": DiscordSRV.warning("[JDA] " + message); break; case "ERROR": if (throwable != null) { DiscordSRV.error("[JDA] " + message + "\n" + ExceptionUtils.getStackTrace(throwable)); } else { DiscordSRV.error("[JDA] " + message); } break; default: if (DiscordSRV.config().getBoolean("DebugJDA")) DiscordSRV.debug("[JDA] " + message); } // all JDA messages should be denied because we handle them ourselves return Result.DENY; }
Example 2
Source File: LogUtil.java From ExNihiloAdscensio with MIT License | 5 votes |
public static void log(Level level, Object object) { String message = object == null ? "null" : object.toString(); String preLine = new SimpleDateFormat("[HH:mm:ss]").format(new Date()) + " [" + level.name() + "] "; for(String line : message.split("\\n")) { logger.log(level, line); logWriter.println(preLine + line); } logWriter.flush(); }
Example 3
Source File: LevelAttributeConverter.java From logging-log4j2 with Apache License 2.0 | 5 votes |
@Override public String convertToDatabaseColumn(final Level level) { if (level == null) { return null; } return level.name(); }