Package com.castlabs.logutils
Class Log
java.lang.Object
com.castlabs.logutils.Log
Custom logger class.
Allows filtering logs by level with the setLogLevel(int) method.
You can also register your own Log.Loggers to get the log messages.
- Since:
- 4.2.0
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceLogger interface that receives logging messages. -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic voidaddLogger(Log.Logger logger) Add aLog.Loggerto receive logging messages.static intSend aLog.DEBUGlog message.static intSend aLog.DEBUGlog message and log the exception.static intSend aLog.ERRORlog message.static intSend aLog.ERRORlog message and log the exception.static intReturns the current log levelstatic intSend aLog.INFOlog message.static intSend aLog.INFOlog message and log the exception.static booleanremoveLogger(Log.Logger logger) Removes a previously registeredLog.Loggerstatic voidsetLogLevel(int logLevel) Sets the log level.static intSend aLog.VERBOSElog message.static intSend aLog.VERBOSElog message and log the exception.static intSend aLog.WARNlog message.static intSend aLog.WARNlog message and log the exception.
-
Field Details
-
DEFAULT_LOG_LEVEL
public static final int DEFAULT_LOG_LEVELDefault log level- See Also:
-
-
Method Details
-
addLogger
Add aLog.Loggerto receive logging messages.- Parameters:
logger- logger to add
-
removeLogger
Removes a previously registeredLog.Logger- Parameters:
logger- the logger to remove- Returns:
- true if removed
-
getLogLevel
public static int getLogLevel()Returns the current log level- Returns:
- the current log level
-
setLogLevel
public static void setLogLevel(int logLevel) Sets the log level.Any messages with the selected log level or higher will be logged.
NOTE: The
Log.Loggers will be called regardless of this log level.- Parameters:
logLevel- the log level to set
-
v
Send aLog.VERBOSElog message.- Parameters:
tag- Used to identify the source of a log message. It usually identifies the class or activity where the log call occurs.msg- The message you would like logged.- Returns:
- number of bytes written by
Log.println(int, String, String)
-
v
Send aLog.VERBOSElog message and log the exception.- Parameters:
tag- Used to identify the source of a log message. It usually identifies the class or activity where the log call occurs.msg- The message you would like logged.tr- An exception to log- Returns:
- number of bytes written by
Log.println(int, String, String)
-
d
Send aLog.DEBUGlog message.- Parameters:
tag- Used to identify the source of a log message. It usually identifies the class or activity where the log call occurs.msg- The message you would like logged.- Returns:
- number of bytes written by
Log.println(int, String, String)
-
d
Send aLog.DEBUGlog message and log the exception.- Parameters:
tag- Used to identify the source of a log message. It usually identifies the class or activity where the log call occurs.msg- The message you would like logged.tr- An exception to log- Returns:
- number of bytes written by
Log.println(int, String, String)
-
i
Send aLog.INFOlog message.- Parameters:
tag- Used to identify the source of a log message. It usually identifies the class or activity where the log call occurs.msg- The message you would like logged.- Returns:
- number of bytes written by
Log.println(int, String, String)
-
i
Send aLog.INFOlog message and log the exception.- Parameters:
tag- Used to identify the source of a log message. It usually identifies the class or activity where the log call occurs.msg- The message you would like logged.tr- An exception to log- Returns:
- number of bytes written by
Log.println(int, String, String)
-
e
Send aLog.ERRORlog message.- Parameters:
tag- Used to identify the source of a log message. It usually identifies the class or activity where the log call occurs.msg- The message you would like logged.- Returns:
- number of bytes written by
Log.println(int, String, String)
-
e
Send aLog.ERRORlog message and log the exception.- Parameters:
tag- Used to identify the source of a log message. It usually identifies the class or activity where the log call occurs.msg- The message you would like logged.tr- An exception to log- Returns:
- number of bytes written by
Log.println(int, String, String)
-
w
Send aLog.WARNlog message.- Parameters:
tag- Used to identify the source of a log message. It usually identifies the class or activity where the log call occurs.msg- The message you would like logged.- Returns:
- number of bytes written by
Log.println(int, String, String)
-
w
Send aLog.WARNlog message and log the exception.- Parameters:
tag- Used to identify the source of a log message. It usually identifies the class or activity where the log call occurs.msg- The message you would like logged.tr- An exception to log- Returns:
- number of bytes written by
Log.println(int, String, String)
-