Tiny logging wrapper dedicated for CLI-oriented applications

Related tags

CLI dynamic-logger
Overview

Dynamic Logger CI codecov

Tiny logging wrapper dedicated for CLI oriented applications with non-static logger that require dynamic threshold/level changes, programmable output formatting, custom levels, print stream redirecting and easily testable output.

Available implementations:

  • System logger
  • In memory logger
  • SL4J implementation
  • Aggregated logger

Artifact

<dependency>
    
    <artifactId>dynamic-loggerartifactId>
    
    <artifactId>dynamic-logger-sl4jartifactId>
    <groupId>net.dzikoyskgroupId>
    <version>1.0.1version>
dependency>

Repository:

<repository>
    <id>panda-repositoryid>
    <url>https://repo.panda-lang.org/releasesurl>
repository>

Usage

Print stream redirecting

PrintStream printStream = logger.toPrintStream();
throwable.printStackTrace(printStream); // pass logger as printstream
printStream.close();

Dynamic threshold change

Logger logger = // logger with INFO level
logger.debug("message"); // filtered
logger.setThreshold(Channel.DEBUG);
logger.debug("message"); // displayed

Custom logging levels

Channel bugs = new Channel("bugs", 100.0, ChannelIntention.NEGATIVE)
logger.log(bugs, "Should not happen");

Testable output

.filter(entry -> Channel.ERROR.equals(entry.getKey())) .filter(entry -> entry.getValue().contains("Exception")) .findAny()) ">
InMemoryLogger logger = new InMemoryLogger();

/*
 * Some code/app/libs using logger
 */

assertTrue(inMemory.contains("Exception"))

// or using custom filters

assertTrue(inMemory.getMessages().stream() // Stream of Entry
    .filter(entry -> Channel.ERROR.equals(entry.getKey()))
    .filter(entry -> entry.getValue().contains("Exception"))
    .findAny())

Aggregation

Logger logger = new AggregatedLogger(
        customLogger,
        new SystemLogger(),
        new Slf4jLogger(LoggerFactory.getLogger("Default logger"), Channel.ALL)
);

Used by

You might also like...

Tiny, easily embeddable HTTP server in Java.

NanoHTTPD – a tiny web server in Java NanoHTTPD is a light-weight HTTP server designed for embedding in other applications, released under a Modified

Jan 1, 2023

Tiny and fast event dispatcher.

HookDispatcher - Tiny and fast event dispatcher. Installation Gradle repositories { maven { url 'https://jitpack.io' } } dependencies { imple

Dec 7, 2021

Simple but powerful SQL library for tiny projects

KiORM - Simple and powerful MySQL Java library for tiny projects Notice: KiORM is still in SNAPSHOT state. The code is not tested, there is no Javadoc

Sep 13, 2022

resetchunks is a tiny fabric mod that re-adds the /resetchunks command, allowing you to regenerate one or more chunks

resetchunks is a tiny fabric mod that enables the /resetchunks command, allowing you to regenerate one or more chunks.

Jul 25, 2022

Repository with LeetCode Solutions and Dedicated Index to prepare for your FAANGM Interviews.

Repository with LeetCode Solutions and Dedicated Index to prepare for your FAANGM Interviews. Feel free to share and Contribute to this repository.

Jan 1, 2023

Objenesis is a library dedicated to bypass the constructor when creating an object. On any JVM there is.

Objenesis Objenesis is a library dedicated to bypass the constructor when creating an object. On any JVM there is. You can find the website and user d

Jan 2, 2023

BioJava is an open-source project dedicated to providing a Java framework for processing biological data.

BioJava is an open-source project dedicated to providing a Java framework for processing biological data.

Welcome to BioJava is an open-source project dedicated to providing a Java framework for processing biological data. It provides analytical and statis

Dec 31, 2022

This repository is totally dedicated to Hacktoberfest 2021, feel free to add your project.

This repository is totally dedicated to Hacktoberfest 2021, feel free to add your project.

push-it-hacktoberfest This repository is totally dedicated to Hacktoberfest 2021, feel free to add your project. HacktoberFest21 Hello Hackers, Contri

Oct 31, 2021

JJazzLab-X is a Midi-based framework dedicated to backing tracks generation

JJazzLab-X is a Midi-based framework dedicated to backing tracks generation

JJazzLab-X is a Midi-based framework dedicated to backing tracks generation -some people talk about "play-along songs" or “auto-accompaniment applications”. You type in chord symbols, select a rhythm (style), then the application generates a complete backing track with drums, bass, guitar, piano, strings, etc.

Jan 3, 2023

An open-source reverse-engineered dedicated server for Frostbite games

FrostbiteServer An open-source reverse-engineered dedicated server for games running on the Frostbite engine. When finished, this will be used to host

Jan 5, 2023

An extensible Java library for HTTP request and response logging

An extensible Java library for HTTP request and response logging

Logbook: HTTP request and response logging Logbook noun, /lɑɡ bʊk/: A book in which measurements from the ship's log are recorded, along with other sa

Dec 29, 2022

The reliable, generic, fast and flexible logging framework for Java.

About logback Thank you for your interest in logback, the reliable, generic, fast and flexible logging library for Java. The Logback documentation can

Jan 7, 2023

Simple Logging Facade for Java

About SLF4J The Simple Logging Facade for Java (SLF4J) serves as a simple facade or abstraction for various logging frameworks (e.g. java.util.logging

Jan 7, 2023

tinylog is a lightweight logging framework for Java, Kotlin, Scala, and Android

tinylog 2 Example import org.tinylog.Logger; public class Application { public static void main(String[] args) { Logger.info("Hello

Dec 30, 2022

Log annotation for logging frameworks

Log annotation for logging frameworks

Herald "Why, sometimes I've believed as many as six impossible things before breakfast." - Lewis Carroll, Alice in Wonderland. Herald provides a very

Dec 21, 2022

Automon combines the power of AOP (AspectJ) with monitoring or logging tools you already use to declaratively monitor your Java code, the JDK, and 3rd party libraries.

Automon combines the power of AOP (AspectJ) with monitoring or logging tools you already use to declaratively monitor your Java code, the JDK, and 3rd party libraries.

Automon Automon combines the power of AOP (AspectJ) with monitoring tools or logging tools that you already use to declaratively monitor the following

Nov 27, 2022

Highly efficient garbage-free logging framework for Java 8+

Garbage Free Log Highly efficient garbage-free logging framework for Java 8+. Use Add the following dependencies to your project: implementation 'com.

Dec 12, 2022

tinylog is a lightweight logging framework for Java, Kotlin, Scala, and Android

tinylog 2 Example import org.tinylog.Logger; public class Application { public static void main(String[] args) { Logger.info("Hello

Jan 4, 2023

Adapts Java platform logging (System.Logger) to SLF4J 1.7.x.

avaje-slf4j-jpl Adapts Java platform logging (System.Logger) to SLF4J 1.7.x. Requires Java 11 or greater. Step 1. Add dependenc

Jan 18, 2022
Comments
  • Cannot print messages with '%' char

    Cannot print messages with '%' char

    java.util.UnknownFormatConversionException: Conversion = '%'
    	at java.util.Formatter.checkText(Formatter.java:2579)
    	at java.util.Formatter.parse(Formatter.java:2565)
    	at java.util.Formatter.format(Formatter.java:2501)
    	at java.util.Formatter.format(Formatter.java:2455)
    	at java.lang.String.format(String.java:2940)
    	at net.dzikoysk.dynamiclogger.backend.DefaultLogger.log(DefaultLogger.java:51)
    	at net.dzikoysk.dynamiclogger.Logger.info(Logger.java:67)
    	at org.panda_lang.pandomium.loader.PandomiumLoader.lambda$load$0(PandomiumLoader.java:34)
    	at org.panda_lang.pandomium.loader.PandomiumLoader.callListeners(PandomiumLoader.java:56)
    	at org.panda_lang.pandomium.loader.PandomiumLoader.updateProgress(PandomiumLoader.java:51)
    	at org.panda_lang.pandomium.loader.PandomiumLoaderWorker.load(PandomiumLoaderWorker.java:28)
    	at org.panda_lang.pandomium.loader.PandomiumLoaderWorker.run(PandomiumLoaderWorker.java:21)
    	at org.panda_lang.pandomium.loader.PandomiumLoader.load(PandomiumLoader.java:41)
    	at org.panda_lang.pandomium.Pandomium.initialize(Pandomium.java:38)
    	at org.panda_lang.pandomium.PandomiumTest.main(PandomiumTest.java:20)
    
    bug 
    opened by dzikoysk 0
Owner
Dzikoysk
#onlypanda 💕 // @cyaffle - second account
Dzikoysk
CLI for NubesGen

CLI for NubesGen This CLI is part of the NubesGen project. It automates a project configuration: on simple projects, running this command line should

Julien Dubois 12 Apr 13, 2022
Mp4grep - a CLI for transcribing and searching audio/video files

mp4grep mp4grep is a tool that transcribes and searches audio and video files for a regex pattern. mp4grep isn't just for mp4 files! It also supports

ooc 250 Dec 23, 2022
httpx is a CLI to execute requests from JetBrains Http File.

httpx: CLI for run http file httpx is a CLI to execute requests from JetBrains Http File. How to use? Create index.http file with following code, then

Libing Chen 106 Dec 29, 2022
AWS JSON TRANSLATOR CLI is a command line application to translate JSON files using AWS Translate

A command line tool to translate JSON files using AWS Translate.

Marc Guillem 0 May 30, 2022
Wrapper around ping command for Windows and MacOS

Wrapper around ping command for Windows and MacOS. Extended with functionality to intercept results provided by the ping command output (latency, ttl and etc.)

Vladislav Kozlov 1 Jan 6, 2022
A library for creating interactive console applications in Java

Text-IO Text-IO is a library for creating Java console applications. It can be used in applications that need to read interactive input from the user.

Beryx 295 Jan 5, 2023
Alibaba Cloud Dedicated KMS Transfer SDK for Java can help Java developers to migrate from the KMS keys to the Dedicated KMS keys.

Alibaba Cloud Dedicated KMS Transfer SDK for Java Alibaba Cloud Dedicated KMS Transfer SDK for Java can help Java developers to migrate from the KMS k

Alibaba Cloud 3 May 12, 2022
Echopraxia - Java Logging API with clean and simple structured logging and conditional & contextual features. Logback implementation based on logstash-logback-encoder.

Echopraxia Echopraxia is a Java logging API that and is designed around structured logging, rich context, and conditional logging. There is a Logback-

Terse Systems 43 Nov 30, 2022
Tiny, easily embeddable HTTP server in Java.

NanoHTTPD – a tiny web server in Java NanoHTTPD is a light-weight HTTP server designed for embedding in other applications, released under a Modified

NanoHttpd 6.5k Jan 1, 2023
Tiny, easily embeddable HTTP server in Java.

NanoHTTPD – a tiny web server in Java NanoHTTPD is a light-weight HTTP server designed for embedding in other applications, released under a Modified

NanoHttpd 6.5k Jan 5, 2023