From fc2d13d1550493a5018bb2a3c18513af7b9e0b18 Mon Sep 17 00:00:00 2001 From: Pikachu920 Date: Sun, 13 May 2018 00:49:38 -0500 Subject: [PATCH] add void logger --- .../skript/scopes/http/ScopeHTTPServer.java | 3 +- .../com/pikachu/webaddon/util/VoidLogger.java | 82 +++++++++++++++++++ 2 files changed, 84 insertions(+), 1 deletion(-) create mode 100644 src/main/java/com/pikachu/webaddon/util/VoidLogger.java diff --git a/src/main/java/com/pikachu/webaddon/skript/scopes/http/ScopeHTTPServer.java b/src/main/java/com/pikachu/webaddon/skript/scopes/http/ScopeHTTPServer.java index 503f1c7..4b02fbf 100644 --- a/src/main/java/com/pikachu/webaddon/skript/scopes/http/ScopeHTTPServer.java +++ b/src/main/java/com/pikachu/webaddon/skript/scopes/http/ScopeHTTPServer.java @@ -110,12 +110,13 @@ public void load() { @Override public void unregister(Trigger t) { // workaround for spark npe - server.get("workaroundForSparkNpe" + UUID.randomUUID().toString(), (req, resp) -> "you shouldn't be seeing this"); + server.options("workaroundForSparkNpe" + UUID.randomUUID().toString(), (req, resp) -> "you shouldn't be seeing this"); server.stop(); } @Override public void unregisterAll() { + unregister(null); } @Override diff --git a/src/main/java/com/pikachu/webaddon/util/VoidLogger.java b/src/main/java/com/pikachu/webaddon/util/VoidLogger.java new file mode 100644 index 0000000..74d8c1a --- /dev/null +++ b/src/main/java/com/pikachu/webaddon/util/VoidLogger.java @@ -0,0 +1,82 @@ +package com.pikachu.webaddon.util; + + +import org.eclipse.jetty.util.log.Logger; + +public class VoidLogger implements Logger { + + @Override + public String getName() { + return "VoidLogger"; + } + + @Override + public void warn(String msg, Object... args) { + + } + + @Override + public void warn(Throwable thrown) { + + } + + @Override + public void warn(String msg, Throwable thrown) { + + } + + @Override + public void info(String msg, Object... args) { + + } + + @Override + public void info(Throwable thrown) { + + } + + @Override + public void info(String msg, Throwable thrown) { + + } + + @Override + public boolean isDebugEnabled() { + return false; + } + + @Override + public void setDebugEnabled(boolean enabled) { + + } + + @Override + public void debug(String msg, Object... args) { + + } + + @Override + public void debug(String msg, long value) { + + } + + @Override + public void debug(Throwable thrown) { + + } + + @Override + public void debug(String msg, Throwable thrown) { + + } + + @Override + public Logger getLogger(String name) { + return new VoidLogger(); + } + + @Override + public void ignore(Throwable ignored) { + + } +}