Package nl.vpro.logging.simple
Available logging frameworks are sometimes a bit hard. The de facto standard at vpro is slf4j. Its interface is however hard to
completely implement.
SimpleLogger
is much easier. A complete implementation may be just a few lines.
Performance is not a key goal of this framework. The main goal is easy of implementation. The basic idea is that a logger is not
much more then a consumer of messages. These could be written to some logger framework, but sometimes you want to do something else
with it too.
E.g. collecting it in JMX calls, or throwing it on web sockets so that web site users can see them too.
A SimpleLogger
therefor is a good choice if methods use some Logger as an argument. The method is somewhat restricted, but the caller can decide what to do with logging very easily.- Since:
- 1.77
- Author:
- Michiel Meeuwissen
-
Interface Summary Interface Description SimpleLogger A very simplified Logger.StringSupplierSimpleLogger -
Class Summary Class Description AbstractStringBuilderSimpleLogger Simply logs everything to a StringBuilder.ChainedSimpleLogger Wraps all log events to zero or more other instances ofSimpleLogger
ConsoleLogger Simply logs everything to stdout/stderrEvent A representation of a log eventEvent.Builder EventSimpleLogger<E extends Event> ASimpleLogger
wraps a consumer for every logEvent
's (or possibly extensions thereof) It is abstract because you need to implement how to instantiate a newEvent
extension viaEventSimpleLogger.createEvent(Level, CharSequence, Throwable)
If you have no need for that, you can instantiate viaEventSimpleLogger.of(Consumer)
, or useEventSimpleLogger.createEvent(Level, CharSequence, Throwable, Clock)
FileSimpleLogger Simply logs everything to a File.FileSimpleLogger.Builder FloggerSimpleLogger JULSimpleLogger SimpleLogger that wraps a java.util.logger.Log4j2SimpleLogger SimpleLogger that wraps log4j2'sLogger
.NOPLogger OutputStreamSimpleLogger ASimpleLogger
implementation that just writes everything to aOutputStream
OutputStreamSimpleLogger.Builder QueueSimpleLogger<E extends Event> ASimpleLogger
that adds every log event to aQueue
ofQueueSimpleLogger.Event
's (or possibly extensions thereof)QueueSimpleLogger.Event Deprecated. Just useEvent
QueueSimpleLogger.Event.Builder SimpleLogger.RemoveFromThreadLocal SimpleLoggerOutputStream If you want to convert aSimpleLogger
to aOutputStream
this can be used.SimpleLoggerWrapper It is hard to wrap every call to e.g.Slf4jSimpleLogger Wraps an SLF4JLogger
StringBuilderSimpleLogger Simply logs everything to a StringBuilder.StringBuilderSimpleLogger.Builder StringSupplierChainedSimpleLogger -
Enum Summary Enum Description Level