Skip to content

Commit

Permalink
Refactor logging and tracing implementations
Browse files Browse the repository at this point in the history
Introduce a `TracingEvent` interface and `SimpleConsoleTracingAppender` for tracing support, while refactoring `LoggingEvent` into an interface and renaming ConsoleAppender to `SimpleConsoleLoggingAppender`. This update also includes making the `Appender` interface generic, restructuring `Logger` and `RootLogger` for better logging and tracing separation, and revising tests to incorporate tracing functionality.
  • Loading branch information
smyrgeorge committed Oct 19, 2024
1 parent afc090b commit 26ad7db
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,9 @@ log.debug { "ignore + ${5}" } // Will be evaluated only if DEBUG logs are enable
log.info("this is a test")

// Support for mute/unmute each logger programmatically.
RootLogger.loggers.mute("io.github.smyrgeorge.log4k.MainTests")
RootLogger.Logging.logges.mute("io.github.smyrgeorge.log4k.MainTests")
log.info("this is a test with 1 arg: {}", "hello")
RootLogger.loggers.unmute(this::class) // Will set the logging level that had before was muted.
log.unmute() // Will set the logging level that had before was muted.
log.info("this is a test with 1 arg: {}", "hello")

try {
Expand All @@ -90,7 +90,7 @@ try {

// Create custom appenders.
// See [BatchAppender] for more information.
class MyBatchAppender(size: Int) : BatchAppender(size) {
class MyBatchAppender(size: Int) : BatchAppender<LoggingEvent>(size) {
override suspend fun append(event: List<LoggingEvent>) {
// E.g. send batch over http.
// In this case every [append] method will be called every 5 elements.
Expand Down

0 comments on commit 26ad7db

Please sign in to comment.