Move net.md_5.bungee.log to its own module.
API subject to change and should not be used externally.
This commit is contained in:
parent
1250088f98
commit
eca99576a0
31
log/nb-configuration.xml
Normal file
31
log/nb-configuration.xml
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project-shared-configuration>
|
||||||
|
<!--
|
||||||
|
This file contains additional configuration written by modules in the NetBeans IDE.
|
||||||
|
The configuration is intended to be shared among all the users of project and
|
||||||
|
therefore it is assumed to be part of version control checkout.
|
||||||
|
Without this configuration present, some functionality in the IDE may be limited or fail altogether.
|
||||||
|
-->
|
||||||
|
<properties xmlns="http://www.netbeans.org/ns/maven-properties-data/1">
|
||||||
|
<!--
|
||||||
|
Properties that influence various parts of the IDE, especially code formatting and the like.
|
||||||
|
You can copy and paste the single properties, into the pom.xml file and the IDE will pick them up.
|
||||||
|
That way multiple projects can share the same settings (useful for formatting rules for example).
|
||||||
|
Any value defined here will override the pom.xml file value but is only applicable to the current project.
|
||||||
|
-->
|
||||||
|
<org-netbeans-modules-editor-indent.CodeStyle.usedProfile>project</org-netbeans-modules-editor-indent.CodeStyle.usedProfile>
|
||||||
|
<org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.classDeclBracePlacement>NEW_LINE</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.classDeclBracePlacement>
|
||||||
|
<org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.otherBracePlacement>NEW_LINE</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.otherBracePlacement>
|
||||||
|
<org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.methodDeclBracePlacement>NEW_LINE</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.methodDeclBracePlacement>
|
||||||
|
<org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinMethodCallParens>true</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinMethodCallParens>
|
||||||
|
<org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinSwitchParens>true</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinSwitchParens>
|
||||||
|
<org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinCatchParens>true</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinCatchParens>
|
||||||
|
<org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinTryParens>true</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinTryParens>
|
||||||
|
<org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinSynchronizedParens>true</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinSynchronizedParens>
|
||||||
|
<org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinArrayInitBrackets>true</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinArrayInitBrackets>
|
||||||
|
<org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinParens>true</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinParens>
|
||||||
|
<org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinWhileParens>true</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinWhileParens>
|
||||||
|
<org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinIfParens>true</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinIfParens>
|
||||||
|
<org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinForParens>true</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinForParens>
|
||||||
|
</properties>
|
||||||
|
</project-shared-configuration>
|
35
log/pom.xml
Normal file
35
log/pom.xml
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
<parent>
|
||||||
|
<groupId>net.md-5</groupId>
|
||||||
|
<artifactId>bungeecord-parent</artifactId>
|
||||||
|
<version>1.10-SNAPSHOT</version>
|
||||||
|
<relativePath>../pom.xml</relativePath>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<groupId>net.md-5</groupId>
|
||||||
|
<artifactId>bungeecord-log</artifactId>
|
||||||
|
<version>1.10-SNAPSHOT</version>
|
||||||
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
|
<name>BungeeCord-Log</name>
|
||||||
|
<description>Simplistic and performant java.util.Logger based logger and console API designed for use with BungeeCord and Minecraft related applications.</description>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>jline</groupId>
|
||||||
|
<artifactId>jline</artifactId>
|
||||||
|
<version>2.14.2</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>net.md-5</groupId>
|
||||||
|
<artifactId>bungeecord-chat</artifactId>
|
||||||
|
<version>${project.version}</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
</project>
|
@ -7,7 +7,7 @@ import java.util.logging.Formatter;
|
|||||||
import java.util.logging.Level;
|
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 jline.console.ConsoleReader;
|
||||||
|
|
||||||
public class BungeeLogger extends Logger
|
public class BungeeLogger extends Logger
|
||||||
{
|
{
|
||||||
@ -20,18 +20,18 @@ public class BungeeLogger extends Logger
|
|||||||
"CallToPrintStackTrace", "CallToThreadStartDuringObjectConstruction"
|
"CallToPrintStackTrace", "CallToThreadStartDuringObjectConstruction"
|
||||||
})
|
})
|
||||||
@SuppressFBWarnings("SC_START_IN_CTOR")
|
@SuppressFBWarnings("SC_START_IN_CTOR")
|
||||||
public BungeeLogger(BungeeCord bungee)
|
public BungeeLogger(String loggerName, String filePattern, ConsoleReader reader)
|
||||||
{
|
{
|
||||||
super( "BungeeCord", null );
|
super( loggerName, null );
|
||||||
setLevel( Level.ALL );
|
setLevel( Level.ALL );
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
FileHandler fileHandler = new FileHandler( "proxy.log", 1 << 24, 8, true );
|
FileHandler fileHandler = new FileHandler( filePattern, 1 << 24, 8, true );
|
||||||
fileHandler.setFormatter( formatter );
|
fileHandler.setFormatter( formatter );
|
||||||
addHandler( fileHandler );
|
addHandler( fileHandler );
|
||||||
|
|
||||||
ColouredWriter consoleHandler = new ColouredWriter( bungee.getConsoleReader() );
|
ColouredWriter consoleHandler = new ColouredWriter( reader );
|
||||||
consoleHandler.setLevel( Level.INFO );
|
consoleHandler.setLevel( Level.INFO );
|
||||||
consoleHandler.setFormatter( formatter );
|
consoleHandler.setFormatter( formatter );
|
||||||
addHandler( consoleHandler );
|
addHandler( consoleHandler );
|
||||||
@ -40,6 +40,7 @@ public class BungeeLogger extends Logger
|
|||||||
System.err.println( "Could not register logger!" );
|
System.err.println( "Could not register logger!" );
|
||||||
ex.printStackTrace();
|
ex.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
dispatcher.start();
|
dispatcher.start();
|
||||||
}
|
}
|
||||||
|
|
@ -79,5 +79,4 @@ public class ColouredWriter extends Handler
|
|||||||
public void close() throws SecurityException
|
public void close() throws SecurityException
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -24,6 +24,7 @@ public class ConciseFormatter extends Formatter
|
|||||||
formatted.append( "] " );
|
formatted.append( "] " );
|
||||||
formatted.append( formatMessage( record ) );
|
formatted.append( formatMessage( record ) );
|
||||||
formatted.append( '\n' );
|
formatted.append( '\n' );
|
||||||
|
|
||||||
if ( record.getThrown() != null )
|
if ( record.getThrown() != null )
|
||||||
{
|
{
|
||||||
StringWriter writer = new StringWriter();
|
StringWriter writer = new StringWriter();
|
1
pom.xml
1
pom.xml
@ -42,6 +42,7 @@
|
|||||||
<module>chat</module>
|
<module>chat</module>
|
||||||
<module>config</module>
|
<module>config</module>
|
||||||
<module>event</module>
|
<module>event</module>
|
||||||
|
<module>log</module>
|
||||||
<module>module</module>
|
<module>module</module>
|
||||||
<module>protocol</module>
|
<module>protocol</module>
|
||||||
<module>proxy</module>
|
<module>proxy</module>
|
||||||
|
@ -33,14 +33,14 @@
|
|||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>jline</groupId>
|
<groupId>net.md-5</groupId>
|
||||||
<artifactId>jline</artifactId>
|
<artifactId>bungeecord-api</artifactId>
|
||||||
<version>2.12</version>
|
<version>${project.version}</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>net.md-5</groupId>
|
<groupId>net.md-5</groupId>
|
||||||
<artifactId>bungeecord-api</artifactId>
|
<artifactId>bungeecord-log</artifactId>
|
||||||
<version>${project.version}</version>
|
<version>${project.version}</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
@ -206,7 +206,7 @@ public class BungeeCord extends ProxyServer
|
|||||||
consoleReader = new ConsoleReader();
|
consoleReader = new ConsoleReader();
|
||||||
consoleReader.setExpandEvents( false );
|
consoleReader.setExpandEvents( false );
|
||||||
|
|
||||||
logger = new BungeeLogger( this );
|
logger = new BungeeLogger( "BungeeCord", "proxy.log", consoleReader );
|
||||||
System.setErr( new PrintStream( new LoggingOutputStream( logger, Level.SEVERE ), true ) );
|
System.setErr( new PrintStream( new LoggingOutputStream( logger, Level.SEVERE ), true ) );
|
||||||
System.setOut( new PrintStream( new LoggingOutputStream( logger, Level.INFO ), true ) );
|
System.setOut( new PrintStream( new LoggingOutputStream( logger, Level.INFO ), true ) );
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user