mirror of
https://github.com/SpigotMC/BungeeCord.git
synced 2024-11-23 18:55:22 +01:00
Write log messages with lower levels to the log file.
This commit is contained in:
parent
4cc009a9c0
commit
a668da76d0
@ -3,6 +3,7 @@ package net.md_5.bungee.log;
|
||||
import java.io.IOException;
|
||||
import java.util.logging.FileHandler;
|
||||
import java.util.logging.Formatter;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.LogRecord;
|
||||
import java.util.logging.Logger;
|
||||
import net.md_5.bungee.BungeeCord;
|
||||
@ -16,6 +17,7 @@ public class BungeeLogger extends Logger
|
||||
public BungeeLogger(BungeeCord bungee)
|
||||
{
|
||||
super( "BungeeCord", null );
|
||||
setLevel( Level.ALL );
|
||||
|
||||
try
|
||||
{
|
||||
@ -24,6 +26,7 @@ public class BungeeLogger extends Logger
|
||||
addHandler( fileHandler );
|
||||
|
||||
ColouredWriter consoleHandler = new ColouredWriter( bungee.getConsoleReader() );
|
||||
consoleHandler.setLevel( Level.INFO );
|
||||
consoleHandler.setFormatter( formatter );
|
||||
addHandler( consoleHandler );
|
||||
} catch ( IOException ex )
|
||||
|
@ -63,7 +63,10 @@ public class ColouredWriter extends Handler
|
||||
@Override
|
||||
public void publish(LogRecord record)
|
||||
{
|
||||
print( getFormatter().format( record ) );
|
||||
if ( isLoggable( record ) )
|
||||
{
|
||||
print( getFormatter().format( record ) );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
Reference in New Issue
Block a user