Colored logs, YAYYYYY
This commit is contained in:
@@ -11,9 +11,9 @@ import java.util.concurrent.ScheduledExecutorService;
|
||||
|
||||
public class JavalinConfig {
|
||||
private static final Map<String, WsContext> users = new ConcurrentHashMap<>();
|
||||
private static final ScheduledExecutorService scheduler = Executors.newSingleThreadScheduledExecutor();
|
||||
|
||||
public static void setup(Javalin app) { app.ws("/discovery", ws -> {
|
||||
public static void setup(Javalin app) {
|
||||
app.ws("/discovery", ws -> {
|
||||
ws.onConnect(ctx -> {
|
||||
String id = ctx.sessionId();
|
||||
users.put(id, ctx);
|
||||
|
||||
@@ -2,11 +2,15 @@ package io.github.lumijiez;
|
||||
|
||||
import io.javalin.Javalin;
|
||||
import io.javalin.json.JavalinGson;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import java.time.Duration;
|
||||
|
||||
public class Main {
|
||||
public static void main(String[] args) {
|
||||
Logger logger = LogManager.getLogger(Main.class);
|
||||
|
||||
Javalin app = Javalin.create(config -> {
|
||||
config.jsonMapper(new JavalinGson());
|
||||
config.jetty.modifyWebSocketServletFactory(wsFactoryConfig -> {
|
||||
@@ -16,6 +20,6 @@ public class Main {
|
||||
|
||||
JavalinConfig.setup(app);
|
||||
|
||||
System.out.print("Discovery service up and running");
|
||||
logger.info("Discovery service up and running. - OK");
|
||||
}
|
||||
}
|
||||
@@ -3,7 +3,9 @@
|
||||
<Appenders>
|
||||
<Console name="Console" target="SYSTEM_OUT">
|
||||
<PatternLayout>
|
||||
<Pattern>%d{yyyy-MM-dd HH:mm:ss} [%t] %-5level: %msg%n</Pattern>
|
||||
<Pattern>
|
||||
%highlight{%d{yyyy-MM-dd HH:mm:ss} %-5level [%t]: %msg}{FATAL=red, ERROR=red, WARN=yellow, INFO=green, DEBUG=blue}%n
|
||||
</Pattern>
|
||||
</PatternLayout>
|
||||
</Console>
|
||||
</Appenders>
|
||||
|
||||
Reference in New Issue
Block a user