diff --git a/NCPCore/src/main/java/fr/neatmonster/nocheatplus/logging/Streams.java b/NCPCore/src/main/java/fr/neatmonster/nocheatplus/logging/Streams.java index 5549889f..e1f87cfe 100644 --- a/NCPCore/src/main/java/fr/neatmonster/nocheatplus/logging/Streams.java +++ b/NCPCore/src/main/java/fr/neatmonster/nocheatplus/logging/Streams.java @@ -1,13 +1,23 @@ package fr.neatmonster.nocheatplus.logging; /** - * Default StreamIDs. + * Default StreamIDs. Before the server is running, it's recommended only to log + * to the INIT stream, because tasks won't be processed before all plugins have + * been loaded. + *
+ * Default LoggerIDs have the same names and are atached to the stream of the + * same name. Additionally there might be default loggers attached to several + * streams with different name and options (e.g. DEFAULT_FILE.name + ".init" + * allowing for direct asynchronous logging on the INIT stream). + *
+ * All names are processed case-insensitive within LogManager. + *
+ * * @author dev1mc * */ public class Streams { - // Maybe temporary: StreamID instances for default usage (custom registrations can not start with "default."). /** * Default prefix, should not be used with custom registration (LoggerID, StreamID). */ @@ -15,16 +25,45 @@ public class Streams { // More or less raw default streams. - /** For initialization and shutdown, not more than primary thread only is guaranteed here. Always available (fall-back). */ + /** + * Default stream for initialization and shutdown, should always be + * available (fall-back). Loggers must not use tasks, not more than primary + * thread only is guaranteed here, might drop messages sent from other + * threads. By default the file logger gets attached, to allow direct + * logging from other threads. + */ public static final StreamID INIT = new StreamID(defaultPrefix + "init"); - /** Might not allow asynchronous access. */ + + /** + * Default stream for the server logger (think of console). Might not allow + * asynchronous access, thus using a task in the primary thread by default. + */ public static final StreamID SERVER_LOGGER = new StreamID(defaultPrefix + "logger.server"); - /** Might not allow asynchronous access. */ + + /** + * Default stream for the plugin logger (Usually the server logger using a + * plugin-dependent prefix.). Might not allow asynchronous access, thus + * using a task in the primary thread by default. + */ public static final StreamID PLUGIN_LOGGER = new StreamID(defaultPrefix + "logger.plugin"); + + /** + * Default ingame notifications (game chat), using a task in the primary + * thread. (The implementation is not thread-safe, even if message sending + * was thread-safe.) + */ public static final StreamID NOTIFY_INGAME = new StreamID(defaultPrefix + "chat.notify"); + + /** + * Default file (defaults to nocheatplus.log), thread-safe. + */ public static final StreamID DEFAULT_FILE = new StreamID(defaultPrefix + "file"); + + /** + * Trace file (might lead to the default file), thread-safe. + */ public static final StreamID TRACE_FILE = new StreamID(defaultPrefix + "file.trace"); - // TODO: More abstract streams (init, trace, violations?), have loggers/files be LoggerID ? + // TODO: Abstract streams: INIT, STATUS, ACTIONS, TRACE. STATUS being similar to INIT, just allowing to use tasks. }