Class Logs


  • public final class Logs
    extends java.lang.Object
    Utility methods for dealing with container logging and recovery.

    Set -Dsisu.debug to send detailed tracing to the console.

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      (package private) static class  Logs.ConsoleSink
      Logs.Sinks messages to the system console.
      (package private) static class  Logs.JULSink
      Logs.Sinks messages to the JDK.
      private static interface  Logs.Sink
      Something that accepts formatted messages.
      (package private) static class  Logs.SLF4JSink
      Logs.Sinks messages via SLF4J.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String NEW_LINE  
      private static Logs.Sink SINK  
      private static java.lang.String SISU  
      static boolean TRACE_ENABLED  
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private Logs()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void catchThrowable​(java.lang.Throwable problem)
      Helper method for catching Throwables; severe errors such as ThreadDeath are always re-thrown.
      private static java.lang.String format​(java.lang.String format, java.lang.Object arg)
      Replaces the first available formatting anchor with the given object.
      static java.lang.String identityToString​(java.lang.Object object)
      Returns an identity string for the given object.
      static void throwUnchecked​(java.lang.Throwable problem)
      Helper method for throwing Throwables; checked exceptions are wrapped as ProvisionExceptions.
      static java.lang.String toString​(com.google.inject.Injector injector)
      Returns a string representation of the given Injector.
      static java.lang.String toString​(com.google.inject.Module module)
      Returns a string representation of the given Module.
      static void trace​(java.lang.String format, java.lang.Object arg1, java.lang.Object arg2)
      Logs a trace message; uses "{}" format anchors.
      static void warn​(java.lang.String format, java.lang.Object arg1, java.lang.Object arg2)
      Logs a warning message; uses "{}" format anchors.
      • Methods inherited from class java.lang.Object

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

      • NEW_LINE

        public static final java.lang.String NEW_LINE
      • TRACE_ENABLED

        public static final boolean TRACE_ENABLED
    • Constructor Detail

      • Logs

        private Logs()
    • Method Detail

      • trace

        public static void trace​(java.lang.String format,
                                 java.lang.Object arg1,
                                 java.lang.Object arg2)
        Logs a trace message; uses "{}" format anchors. Pass Throwables in last parameter for special handling.
        Parameters:
        format - The trace message format
        arg1 - First object to format
        arg2 - Second object to format
      • warn

        public static void warn​(java.lang.String format,
                                java.lang.Object arg1,
                                java.lang.Object arg2)
        Logs a warning message; uses "{}" format anchors. Pass Throwables in last parameter for special handling.
        Parameters:
        format - The warning message format
        arg1 - First object to format
        arg2 - Second object to format
      • catchThrowable

        public static void catchThrowable​(java.lang.Throwable problem)
        Helper method for catching Throwables; severe errors such as ThreadDeath are always re-thrown.
        Parameters:
        problem - The problem
      • throwUnchecked

        public static void throwUnchecked​(java.lang.Throwable problem)
        Helper method for throwing Throwables; checked exceptions are wrapped as ProvisionExceptions.
        Parameters:
        problem - The problem
      • identityToString

        public static java.lang.String identityToString​(java.lang.Object object)
        Returns an identity string for the given object.
        Parameters:
        object - The object
        Returns:
        Identity string of the object.
        See Also:
        System.identityHashCode(Object)
      • toString

        public static java.lang.String toString​(com.google.inject.Module module)
        Returns a string representation of the given Module.
        Parameters:
        module - The module
        Returns:
        String representation of the module.
      • toString

        public static java.lang.String toString​(com.google.inject.Injector injector)
        Returns a string representation of the given Injector.
        Parameters:
        injector - The injector
        Returns:
        String representation of the injector.
      • format

        private static java.lang.String format​(java.lang.String format,
                                               java.lang.Object arg)
        Replaces the first available formatting anchor with the given object.
        Parameters:
        format - The format string
        arg - The object to format