Skip to content

cslee00/digitalascent-fluent-logger

Repository files navigation

Fluent logger based on Google Flogger that provides conventional error, warn, info, debug, and trace levels, avoiding use of java.util.logging (JUL) levels in code that doesn't otherwise use JUL.

1. Add the dependencies

2. Add import for FluentLogger

import com.digitalascent.logger.FluentLogger;

3. Create a private static final instance

private static final FluentLogger logger = FluentLogger.forEnclosingClass();

4. Start Logging:

logger.atError().withCause(exception).log("Log message with: %s", argument);

This implementation differs from Google's FluentLogger in these ways:

  • provides a different set of level selectors: atError(), atWarn(), atInfo(), atDebug(), atTrace()
  • returns an interface from FluentLogger.forEnclosingClass() instead of a concrete implementation
  • uses a static default method on the FluentLogger interface instead of on the concrete logger instance, allowing the implementation class to change w/o changing calling code
  • JDK 8+ is required

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages