mirror of
https://github.com/SpigotMC/BungeeCord.git
synced 2024-11-27 20:59:12 +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.io.IOException;
|
||||||
import java.util.logging.FileHandler;
|
import java.util.logging.FileHandler;
|
||||||
import java.util.logging.Formatter;
|
import java.util.logging.Formatter;
|
||||||
|
import java.util.logging.Level;
|
||||||
import java.util.logging.LogRecord;
|
import java.util.logging.LogRecord;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
import net.md_5.bungee.BungeeCord;
|
import net.md_5.bungee.BungeeCord;
|
||||||
@ -16,6 +17,7 @@ public class BungeeLogger extends Logger
|
|||||||
public BungeeLogger(BungeeCord bungee)
|
public BungeeLogger(BungeeCord bungee)
|
||||||
{
|
{
|
||||||
super( "BungeeCord", null );
|
super( "BungeeCord", null );
|
||||||
|
setLevel( Level.ALL );
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -24,6 +26,7 @@ public class BungeeLogger extends Logger
|
|||||||
addHandler( fileHandler );
|
addHandler( fileHandler );
|
||||||
|
|
||||||
ColouredWriter consoleHandler = new ColouredWriter( bungee.getConsoleReader() );
|
ColouredWriter consoleHandler = new ColouredWriter( bungee.getConsoleReader() );
|
||||||
|
consoleHandler.setLevel( Level.INFO );
|
||||||
consoleHandler.setFormatter( formatter );
|
consoleHandler.setFormatter( formatter );
|
||||||
addHandler( consoleHandler );
|
addHandler( consoleHandler );
|
||||||
} catch ( IOException ex )
|
} catch ( IOException ex )
|
||||||
|
@ -63,7 +63,10 @@ public class ColouredWriter extends Handler
|
|||||||
@Override
|
@Override
|
||||||
public void publish(LogRecord record)
|
public void publish(LogRecord record)
|
||||||
{
|
{
|
||||||
print( getFormatter().format( record ) );
|
if ( isLoggable( record ) )
|
||||||
|
{
|
||||||
|
print( getFormatter().format( record ) );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
Reference in New Issue
Block a user