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.Logger
s to get the log messages.
- Since:
- 4.2.0
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interface
Logger interface that receives logging messages. -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic void
addLogger
(Log.Logger logger) Add aLog.Logger
to receive logging messages.static int
Send aLog.DEBUG
log message.static int
Send aLog.DEBUG
log message and log the exception.static int
Send aLog.ERROR
log message.static int
Send aLog.ERROR
log message and log the exception.static int
Returns the current log levelstatic int
Send aLog.INFO
log message.static int
Send aLog.INFO
log message and log the exception.static boolean
removeLogger
(Log.Logger logger) Removes a previously registeredLog.Logger
static void
setLogLevel
(int logLevel) Sets the log level.static int
Send aLog.VERBOSE
log message.static int
Send aLog.VERBOSE
log message and log the exception.static int
Send aLog.WARN
log message.static int
Send aLog.WARN
log 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.Logger
to 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.Logger
s will be called regardless of this log level.- Parameters:
logLevel
- the log level to set
-
v
Send aLog.VERBOSE
log 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.VERBOSE
log 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.DEBUG
log 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.DEBUG
log 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.INFO
log 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.INFO
log 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.ERROR
log 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.ERROR
log 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.WARN
log 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.WARN
log 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)
-