mirror of
https://github.com/games647/ColorConsole.git
synced 2024-11-13 06:04:46 +01:00
Colorize only the logging level not the complete message
This commit is contained in:
parent
59f4f3a42e
commit
e990efc1b1
17
pom.xml
17
pom.xml
@ -8,7 +8,7 @@
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>ColorConsole</name>
|
||||
<version>1.8</version>
|
||||
<version>1.9</version>
|
||||
<inceptionYear>2016</inceptionYear>
|
||||
<url>http://dev.bukkit.org/bukkit-plugins/colorconsole/</url>
|
||||
<description>
|
||||
@ -41,7 +41,7 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.6.0</version>
|
||||
<version>3.6.1</version>
|
||||
<configuration>
|
||||
<source>1.8</source>
|
||||
<target>1.8</target>
|
||||
@ -102,7 +102,7 @@
|
||||
<dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot-api</artifactId>
|
||||
<version>1.9-R0.1-SNAPSHOT</version>
|
||||
<version>1.12-pre2-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
@ -117,16 +117,15 @@
|
||||
<dependency>
|
||||
<groupId>org.spongepowered</groupId>
|
||||
<artifactId>spongeapi</artifactId>
|
||||
<version>5.0.0</version>
|
||||
<type>jar</type>
|
||||
<version>6.1.0-20170502.022019-1</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.fusesource.jansi</groupId>
|
||||
<artifactId>jansi</artifactId>
|
||||
<version>1.11</version>
|
||||
<scope>provided</scope>
|
||||
<groupId>jline</groupId>
|
||||
<artifactId>jline</artifactId>
|
||||
<version>2.12.1</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
|
@ -62,13 +62,13 @@ public class ColorConsoleBukkit extends JavaPlugin {
|
||||
oldLayout = terminalAppender.getLayout();
|
||||
String logFormat = getConfig().getString("logFormat");
|
||||
if (getConfig().getBoolean("colorLoggingLevel")) {
|
||||
logFormat = "%highlight{" + logFormat + "}{"
|
||||
logFormat = "[%highlight{%d{HH:mm:ss} %level}{" + logFormat + "}{"
|
||||
+ "FATAL=" + getConfig().getString("FATAL") + ", "
|
||||
+ "ERROR=" + getConfig().getString("ERROR") + ", "
|
||||
+ "WARN=" + getConfig().getString("WARN") + ", "
|
||||
+ "INFO=" + getConfig().getString("INFO") + ", "
|
||||
+ "DEBUG=" + getConfig().getString("DEBUG") + ", "
|
||||
+ "TRACE=" + getConfig().getString("TRACE") + "}";
|
||||
+ "TRACE=" + getConfig().getString("TRACE") + "}] %msg%n";
|
||||
}
|
||||
|
||||
PatternLayout layout = PatternLayout
|
||||
|
@ -66,6 +66,8 @@ public class ColorLogFormatter extends Formatter {
|
||||
formatted.append(record.getLevel().getName());
|
||||
formatted.append("] ");
|
||||
|
||||
formatted.append(Ansi.ansi().reset().toString());
|
||||
|
||||
if (plugin.getConfiguration().getBoolean("colorPluginTag")) {
|
||||
message = colorizePluginTag(message, levelColor);
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ import java.lang.reflect.Field;
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.file.Path;
|
||||
|
||||
@Plugin(id = "colorconsole", name = "ColorConsole", version = "1.6"
|
||||
@Plugin(id = "colorconsole", name = "ColorConsole", version = "1.9"
|
||||
, url = "https://github.com/games647/ColorConsole/"
|
||||
, description = "Print colorful console messages depending on the logging level")
|
||||
public class ColorConsoleSponge {
|
||||
@ -89,13 +89,13 @@ public class ColorConsoleSponge {
|
||||
|
||||
String logFormat = configMapper.getInstance().getLogFormat();
|
||||
if (configMapper.getInstance().isColorLoggingLevel()) {
|
||||
logFormat = "%highlight{" + logFormat + "}{"
|
||||
logFormat = "[%highlight{%d{HH:mm:ss} %level}{" + logFormat + "}{"
|
||||
+ "FATAL=" + configMapper.getInstance().getLevelColors().get("FATAL") + ", "
|
||||
+ "ERROR=" + configMapper.getInstance().getLevelColors().get("ERROR") + ", "
|
||||
+ "WARN=" + configMapper.getInstance().getLevelColors().get("WARN") + ", "
|
||||
+ "INFO=" + configMapper.getInstance().getLevelColors().get("INFO") + ", "
|
||||
+ "DEBUG=" + configMapper.getInstance().getLevelColors().get("DEBUG") + ", "
|
||||
+ "TRACE=" + configMapper.getInstance().getLevelColors().get("TRACE") + "}";
|
||||
+ "TRACE=" + configMapper.getInstance().getLevelColors().get("TRACE") + "}] %msg%n";
|
||||
}
|
||||
|
||||
PatternLayout layout = PatternLayout
|
||||
|
Loading…
Reference in New Issue
Block a user