Everybody needs logs. Humans and machines. Logs should be structured, json and text format. Library should me modular, provide full customisation of router, rendering policies, sinks, dynamic client context. What if we could provide a such logging library with compile-time structure and context extraction which satisfies both? Let’s dive into LogStage and try to implement own asynchronous sink for logs.
About the author:
Maksym Ratoshniuk: Maksym is interested in Big Data, distributed and scalable Architecture Design and Functional Programming.
logstage: https://izumi.7mind.io/latest/release/doc/logstage/index.html
4. Common use cases:
● Tracing
● Liveness of your system
● Metrics
○ DB Calls
○ Http flow
○ Payment processing
○ Scheduling (jobs)
● Analytics
○ User behaviour
○ A/B Testing
15. Logging always should be easy to read...
class ExampleService(log: IzLogger) {
val justAnArg = "example"
val justAList = List[Any](10, "green", "bottles")
log.trace(s"Argument: $justAnArg, another arg: $justAList")
log.info(s"Named expression: ${Random.nextInt() -> "random number"}")
log.warn(s"Invisible: ${Random.nextInt() -> "random number" -> null}")
val ctxLog = log("userId" -> "user@google.com", "company" -> "acme")
val delta = Random.nextInt(1000)
ctxLog.info(s"Processing time: $delta")
}
16. … and easier to deal with
class ExampleService(logger: IzLogger)
{
val justAnArg = "example"
val justAList = List[Any](
10, "green", "bottles"
)
logger.trace(
s"Argument: $justAnArg, another
arg: $justAList"
)
}
36. Plans to work with
● Rethinking of rendering policy
● Better configuration
● Integrations with Logback, Azure,
ElasticSearch, Kafka
● Profiling and optimization performance