All Projects → forax → beautiful_logger

forax / beautiful_logger

Licence: MIT license
Yet another logger API in Java with beautiful features

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to beautiful logger

sqlite micro logger arduino
Fast and Lean Sqlite database logger for Microcontrollers
Stars: ✭ 128 (+113.33%)
Mutual labels:  logger, logging-library
Izumi
Productivity-oriented collection of lightweight fancy stuff for Scala toolchain
Stars: ✭ 423 (+605%)
Mutual labels:  logger, logging-library
Cocoadebug
iOS Debugging Tool 🚀
Stars: ✭ 3,769 (+6181.67%)
Mutual labels:  logger, logging-library
Tslog
📝 tslog - Expressive TypeScript Logger for Node.js.
Stars: ✭ 321 (+435%)
Mutual labels:  logger, logging-library
LogDNA-Android-Client
Android client for LogDNA
Stars: ✭ 22 (-63.33%)
Mutual labels:  logger, logging-library
Electron Timber
Pretty logger for Electron apps
Stars: ✭ 337 (+461.67%)
Mutual labels:  logger, logging-library
noodlog
🍜 Parametrized JSON logging library in Golang which lets you obfuscate sensitive data and marshal any kind of content.
Stars: ✭ 42 (-30%)
Mutual labels:  logger, logging-library
loggin-js
📝 Customizable and expandable logger for Node.js
Stars: ✭ 20 (-66.67%)
Mutual labels:  logger, logging-library
l
Cross-platform html/io [L]ogger with simple API.
Stars: ✭ 26 (-56.67%)
Mutual labels:  logger, logging-library
Timber Elixir
🌲 Great Elixir logging made easy
Stars: ✭ 226 (+276.67%)
Mutual labels:  logger, logging-library
Woodlot
An all-in-one JSON logging utility that supports ExpressJS HTTP logging, custom logging, provides multi-format output and an easy to use events API.
Stars: ✭ 263 (+338.33%)
Mutual labels:  logger, logging-library
RxLogs
An Android & Kotlin Reactive Advanced Logging Framework.
Stars: ✭ 12 (-80%)
Mutual labels:  logger, logging-library
Go Logger
Simple logger for Go programs. Allows custom formats for messages.
Stars: ✭ 261 (+335%)
Mutual labels:  logger, logging-library
Tinylog
tinylog is a lightweight logging framework for Java, Kotlin, Scala, and Android
Stars: ✭ 360 (+500%)
Mutual labels:  logger, logging-library
winston-telegram
A Telegram transport for winston
Stars: ✭ 28 (-53.33%)
Mutual labels:  logger, logging-library
Quill
Asynchronous Low Latency C++ Logging Library
Stars: ✭ 422 (+603.33%)
Mutual labels:  logger, logging-library
moesif-nodejs
Moesif Nodejs Middleware Library (formerly Moesif-Express)
Stars: ✭ 36 (-40%)
Mutual labels:  logger, logging-library
Lighty
Easy to use and lightweight logger for iOS, macOS, tvOS, watchOS and Linux in Swift.
Stars: ✭ 49 (-18.33%)
Mutual labels:  logger, logging-library
Ring Log
Ring-Log是一个高效简洁的C++异步日志, 其特点是效率高(每秒支持至少125万+日志写入)、易拓展,尤其适用于频繁写日志的场景
Stars: ✭ 201 (+235%)
Mutual labels:  logger, logging-library
JJSwiftLog
Swift log library for all platform
Stars: ✭ 51 (-15%)
Mutual labels:  logger, logging-library

beautiful_logger .github/workflows/main.yml

Yet another logger API in Java with beautiful features

beautiful_logger is a mostly-zero-overhead wrapper on top of the existing logging implementations with a familiar API (info, error, etc) that let you configure/re-configure the logger dynamically in a programmatic way.

This library requires at least Java 8 at runtime and is fully compatible with Java 9 modules.

For the support of Java 15+, the version 0.10.4+ should be used.

The javadoc of the latest version is available online.

Features

  • real zero cost (no allocation, no branch, no assembly code) if a logger is disabled
  • zero overhead cost when delegating to the logging libraries you already use, SLF4J, Log4J, Logback, JUL or SystemLogger JEP 264.
  • dynamic configuration/re-configuration which doesn't use costly inter-thread signaling
  • no configuration file, no XML, etc, everything is done programmatically
  • very small modular jar with no dependency

Why another logging API ?

Technically it's more a facade like SLF4J, anyway, beautiful_logger exists because no other existing logging libraries provide at least one of features listed above.

Why do you claim that there is no overhead ?

The implementation of this API ensures that the JIT can fully inline any calls to the Logger API without decrementing your inlining budget. This is similar to the way, MethodHandle or VarHandle are optimized in the JDK. The main drawback is that it put more pressure to the JITs so it may lengthen the time to steady state of an application.

Example

import com.github.forax.beautifullogger.Logger;

class Example {
  // getLogger with no argument uses the current class as configuration class
  private static final Logger LOGGER = Logger.getLogger();
  
  public static void main(String[] args) {
    for(int i = 0; i < 10; i++) {
      // use a lambda that does not capture any parameters 
      LOGGER.error((int value) -> "message " + value, i);
      
      if (i == 1) {
        // disable the logger programmatically
        LoggerConfig.fromClass(Example.class).update(opt -> opt.enable(false));
      }
    }
  }
}

Build Tool Integration

Get latest binary distribution via JitPack

Maven

  <repositories>
      <repository>
          <id>jitpack.io</id>
          <url>https://jitpack.io</url>
      </repository>
  </repositories>
  <dependency>
      <groupId>com.github.forax</groupId>
      <artifactId>beautiful_logger</artifactId>
      <version>master-SNAPSHOT</version>
  </dependency>

Gradle

  repositories {
      ...
      maven { url 'https://jitpack.io' }
  }
  dependencies {
      compile 'com.github.forax:beautiful_logger:master-SNAPSHOT'
  }
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].