jstachio / rainbowgum Goto Github PK
View Code? Open in Web Editor NEWFast, Small, JDK 21+, GraalVM native friendly SLF4J logging framework
License: BSD 3-Clause "New" or "Revised" License
Fast, Small, JDK 21+, GraalVM native friendly SLF4J logging framework
License: BSD 3-Clause "New" or "Revised" License
PS: one small suggestion though, you may have noticed that I did include not just core
, but also pattern
explicitly, as having it pulled transitively by gradle
does not make it accessible as implementation
even if io.jstach.rainbowgum:rainbowgum
is included as such. I think to have a better developer ergonomic, when including io.jstach.rainbowgum:rainbowgum
, the transitive dependencies should be pulled in with the same scope so that having implementation("io.jstach.rainbowgum:rainbowgum:0.2.0")
is enough. When just wanting to use the defaults, having runtimeOnly("io.jstach.rainbowgum:rainbowgum:0.2.0")
should be sufficient.
Originally posted by @cmdjulian in #55 (comment)
Not quite sure why, but only the first log statement gets actually logged, the other two invocations don't print anything. Am I doing something wrong here?
private val logger = KotlinLogging.logger {}
fun main() {
logger.info { "Hello, World!" }
logger.error(IllegalArgumentException()) { "Hello, World!" }
logger.error("Hello, World!", IllegalArgumentException())
}
It seems like this is for all logger methods which do include a Throwable
in their signature. The logger faced I'm using on top of Rainbowgum
is kotlin-logging which relies on slf4j
. For other loggers like logback
everything works as it should.
I created a small reproducer: logger.zip
Rainbow Gum needs a way to collect errors for microservices that do health checks.
Logback does this I think with something called Status or Status Manager.
Not sure Log4j2 does but probably similar.
Currently catastrophic failures are just System.err
but if we provide resilient outputs we will want to keep track of this.
Currently JANSI when enabled will strip ANSI characters. An alternative is not print ANSI escape codes with the the pattern encoder if (or):
Right now we only let JANSI do stripping. See #55
Thank you for spending energy to a modern logging framework.
At https://github.com/jstachio/rainbowgum?tab=readme-ov-file#comparison-to-other-frameworks, I miss a comparison to tinylog2, which also has similar goals (IMHO).
I have the following logger:
@AutoService(RainbowGumProvider::class)
class RainbowGumProviderImpl : RainbowGumProvider {
override fun provide(config: LogConfig): Optional<RainbowGum> = RainbowGum.builder(config)
.route { builder ->
builder.level(Level.INFO)
builder.appender("console") { appender ->
val encoder = PatternEncoderBuilder("console")
.pattern("%cyan(%d{YYYY-MM-dd HH:mm:ss.SSS}) [%yellow(%thread)] %highlight(%-5level) %logger{36}: %msg%n")
.fromProperties(config.properties())
.build()
appender.encoder(encoder)
appender.output(LogOutput.ofStandardOut())
}
}
.optional()
}
This is my gradle config:
dependencies {
ksp("dev.zacsweers.autoservice:auto-service-ksp:1.1.0")
implementation("com.google.auto.service:auto-service-annotations:1.1.1")
// logging
implementation("io.jstach.rainbowgum:rainbowgum:0.2.0")
implementation("io.jstach.rainbowgum:rainbowgum-core:0.2.0")
implementation("io.jstach.rainbowgum:rainbowgum-pattern:0.2.0")
implementation("io.jstach.rainbowgum:rainbowgum-jansi:0.2.0")
}
As you can see in my pattern I have configured colored output. Regardless of that the output is just white. Is there something I do wrong?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.