Class LogsKt
-
- All Implemented Interfaces:
public final class LogsKt
-
-
Method Summary
Modifier and Type Method Description final static <T extends Any> LoggergetLogger(KClass<T> clazz)final static <T extends Any> LoggergetLogger(KClass<T> clazz, String postfix)final static LoggergetLogger(Object target)final static LoggergetLogger(Object target, String postfix)final static LoggergetTracerOrNull(Object target)final static LoggergetRandomLogger()final static UnitcatastrophicError(Throwable t, String message, Object args)Log messages using System.err and Throwable.printStackTrace in the case when the logging system was crashed. final static Unitwarn(Object target, String message, Object args)final static Unitwarn(Object target, Throwable t, String message, Object args)final static UnitwarnInterruptible(Object target, Throwable t)Log a warning message for an interruptible exception. final static UnitwarnInterruptible(Object target, Throwable t, String message, Object args)Log a warning message for an interruptible exception. final static UnitwarnUnexpected(Object target, Throwable t)Log a warning message for an unexpected exception. final static UnitwarnUnexpected(Object target, Throwable t, String message, Object args)Log a warning message for an unexpected exception. final static UnitwarnForClose(Object target, Throwable t)Log a warning message for a close method that throws an exception. final static UnitwarnForClose(Object target, Throwable t, String message, Object args)Log a warning message for a close method that throws an exception. -
-
Method Detail
-
getTracerOrNull
final static Logger getTracerOrNull(Object target)
-
getRandomLogger
final static Logger getRandomLogger()
-
catastrophicError
final static Unit catastrophicError(Throwable t, String message, Object args)
Log messages using System.err and Throwable.printStackTrace in the case when the logging system was crashed.
- Parameters:
t- the exception thrown by the close methodmessage- the message to log
-
warnInterruptible
final static Unit warnInterruptible(Object target, Throwable t)
Log a warning message for an interruptible exception.
This method logs the exception and manages InterruptedException.
- Parameters:
target- the object that is being closedt- the exception thrown by the close method
-
warnInterruptible
final static Unit warnInterruptible(Object target, Throwable t, String message, Object args)
Log a warning message for an interruptible exception.
This method logs the exception and manages InterruptedException.
- Parameters:
target- the object that is being closedt- the exception thrown by the close methodmessage- the message to log
-
warnUnexpected
final static Unit warnUnexpected(Object target, Throwable t)
Log a warning message for an unexpected exception.
The exception is unexpected, it's best managed within custom code, such as event handlers. This method logs the exception, manages InterruptedException, and logs a message to emphasize that the exception is unexpected.
- Parameters:
target- the object that is being closedt- the exception thrown by the close method
-
warnUnexpected
final static Unit warnUnexpected(Object target, Throwable t, String message, Object args)
Log a warning message for an unexpected exception.
The exception is unexpected, it's best managed within custom code, such as event handlers. This method logs the exception, manages InterruptedException, and logs a message to emphasize that the exception is unexpected.
- Parameters:
target- the object that is being closedt- the exception thrown by the close methodmessage- the message to log
-
warnForClose
final static Unit warnForClose(Object target, Throwable t)
Log a warning message for a close method that throws an exception.
It's very common for the close method to suppress exceptions and just log it, but some exceptions should be carefully handled, such as InterruptedException. It's strongly advised to not have the close method throw InterruptedException, but it's not guaranteed, so we suppress it and log a warning message if it happens.
- Parameters:
target- the object that is being closedt- the exception thrown by the close method
-
warnForClose
final static Unit warnForClose(Object target, Throwable t, String message, Object args)
Log a warning message for a close method that throws an exception.
It's very common for the close method to suppress exceptions and just log it, but some exceptions should be carefully handled, such as InterruptedException. It's strongly advised to not have the close method throw InterruptedException, but it's not guaranteed, so we suppress it and log a warning message if it happens.
- Parameters:
target- the object that is being closedt- the exception thrown by the close methodmessage- the message to log
-
-
-
-