-
Notifications
You must be signed in to change notification settings - Fork 42
Features
Matt Hicks edited this page Jun 30, 2022
·
14 revisions
- Written from scratch in pure Scala
- Fastest logging library for the JVM (see: https://github.com/outr/scribe/wiki/benchmarks)
- Beautiful, rich output to consoles that support it:
- Rich output in the content of the message with DSL:
import scribe.output._
scribe.info(out(
"Custom colors ",
blue("are supported "),
bgRed("with backgrounds "),
bgCyan(
"even ",
green("layered "),
red(
"styles ",
italic("are supported")
)
)
))
- Platform-specific colored output for ANSI, ASCII, HTML, JSON, and even browser-based rich output
- Programmatic configuration to integrate easily with existing config files
- Hot-change capabilities to modify how logging works in real-time
Logger("myLogger") // Look-up or create the named logger
.orphan() // This keeps the logger from propagating any records up the hierarchy
.clearHandlers() // Clears any existing handlers on this logger
.withHandler(minimumLevel = Some(Level.Error)) // Adds a new handler to this logger
.replace() // Replaces by id and name this logger globally allowing programmatic hot-change
- Asynchronous logger to provide nearly zero-impact logging
Logger.root.clearHandlers().withHandler(handle = AsynchronousLogHandle(
maxBuffer = 5000,
overflow = Overflow.DropOld
))
scribe.info("Near zero performance impact!")
- Lazily evaluated log messages that are only evaluated if written to output
- Pure Scala SLF4J implementation
- MDC support to log additional information with each log output
- MDC compliance with SLF4J
- MDC.global to support global values assigned to all logging
- MDC Support for cross-thread usage:
MDC { implicit mdc =>
mdc("key") = "value"
mdc("key2") = "value2"
val f = Future {
scribe.info("this will include the MDC key/value")
}
Await.result(f, Duration.Inf)
}
- Simple and convenient formatter creation via interpolation:
formatter"$date [$threadNameAbbreviated] $level $position - $message$mdc"
- Zero-cost tracing (include class, method, and line number) generated at compile-time
- Zero-import logging:
scribe.info("No imports necessary")
- Scala.js and ScalaNative support
- Scala 2.11, 2.12, 2.13, and Dotty support
- Migration library to support importing existing configuration files for other logging systems
- Slack logging module
- Logstash logging module
- Simple timing functionality with elapsed:
scribe.elapsed { ... logging statements include MDC values for elapsed time ... }