Class AbstractBackend

  • Direct Known Subclasses:
    SimpleLoggerBackend

    public abstract class AbstractBackend
    extends com.google.common.flogger.backend.LoggerBackend
    Common backend to handle everything except formatting of log message and metadata. This is an unstable implementation and should not be used outside of the Flogger core library.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected AbstractBackend​(java.lang.String loggingClass)
      Constructs an abstract backend for the given class name.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String getLoggerName()  
      boolean isLoggable​(java.util.logging.Level lvl)  
      void log​(java.util.logging.LogRecord record, boolean wasForced)
      Logs the given record using this backend.
      • Methods inherited from class com.google.common.flogger.backend.LoggerBackend

        handleError, log
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • AbstractBackend

        protected AbstractBackend​(java.lang.String loggingClass)
        Constructs an abstract backend for the given class name.

        Nested or inner class names (containing $ are converted to names matching the standard JDK logger namespace by converting '$' to '.', but in future it is expected that nested and inner classes (especially anonymous ones) will have their names truncated to just the outer class name. There is no benefit to having loggers named after an inner/nested classes, and this distinction is expected to go away.

    • Method Detail

      • getLoggerName

        public final java.lang.String getLoggerName()
        Specified by:
        getLoggerName in class com.google.common.flogger.backend.LoggerBackend
      • isLoggable

        public final boolean isLoggable​(java.util.logging.Level lvl)
        Specified by:
        isLoggable in class com.google.common.flogger.backend.LoggerBackend
      • log

        public final void log​(java.util.logging.LogRecord record,
                              boolean wasForced)
        Logs the given record using this backend. If wasForced is set, the backend will make a best effort attempt to bypass any log level restrictions in the underlying Java Logger, but there are circumstances in which this can fail.