See: Description
| Class | Description |
|---|---|
| FluentLogger |
FluentLogger is what we use to start logging at different levels.
|
| FluentLoggerFactory |
The entry point for using slf4j-fluent.
|
| LoggerAtLevel |
This is where the fluent API of slf4j-fluent is implemented.
|
| NOOPLogger |
A no-op logger is a logger that does nothing.
|
| Util |
import static org.fissore.slf4j.Util.lazy;
...
FluentLogger log = FluentLoggerFactory.getLogger(getClass());
log.debug().log("A debug log entry with {} args: {}, {}", 2, "value 1", lazy(() -> someObject.expensiveMethod()));
// will add the stacktrace of the cause to the log entry
log.error().withCause(exception).log("An error occured while fetching user {}", user.getId());
// will log every 5 calls to `log` method, instead of every single time
log.error().every(5).log("Errors occured, but we print only one entry every 5");
// will log every 1 second, instead of every single time
log.error().every(1, ChronoUnit.SECONDS).log("Errors occured, but we print only one entry every 1 second");
Copyright © 2019. All rights reserved.