Skip to content

Commit

Permalink
Remove unnecessary runBlocking wrapper in README example
Browse files Browse the repository at this point in the history
The `runBlocking` wrapper was removed to simplify the example code in the README file. This change makes the example more straightforward, focusing on the usage of the custom appender and tracing spans without the additional complexity of coroutine management.
  • Loading branch information
smyrgeorge committed Oct 20, 2024
1 parent 935a967 commit 7ac0ed5
Showing 1 changed file with 23 additions and 28 deletions.
51 changes: 23 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,34 +133,29 @@ class MyBatchAppender(size: Int) : BatchAppender<LoggingEvent>(size) {
}
}

runBlocking {
delay(2000)
val appender = MyBatchAppender(5)
// Register the appender.
RootLogger.Logging.appenders.register(appender)

// Will print:
// 0, 1, 2, 3, 4
// 5, 6, 7, 8, 9
repeat(10) {
log.info("$it")
delay(500)
}

delay(2000)

// Starts immediately the span.
trace.span("test") {
// Send events that are related to the current span.
it.event("this is a test event")
// Automatically closes at the end of te scope.
}
val appender = MyBatchAppender(5)
// Register the appender.
RootLogger.Logging.appenders.register(appender)

// Will print:
// 0, 1, 2, 3, 4
// 5, 6, 7, 8, 9
repeat(10) {
log.info("$it")
delay(500)
}

// Create the span and then start it.
val span: TracingEvent.Span = trace.span("test").start()
span.event("this is a test event")
span.tracer
// Close the span manually.
span.end()
// Starts immediately the span.
trace.span("test") {
// Send events that are related to the current span.
it.event("this is a test event")
// Automatically closes at the end of te scope.
}

// Create the span and then start it.
val span: TracingEvent.Span = trace.span("test").start()
span.event("this is a test event")
span.tracer
// Close the span manually.
span.end()
```

0 comments on commit 7ac0ed5

Please sign in to comment.