Package com.prineside.tdi2.utils.logging
Class TLog
java.lang.Object
com.prineside.tdi2.utils.logging.TLog
The proper way to log things.
Normally each class which logs something uses a single static field with its own instance of TLog.
For Lua scripts, it is preferable to create a local logger per file, with a tag which will allow to
find out quickly which script uses it:
local logger = TLog.class:forTag("scriptName")
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionvoid
Print a Debug message.void
Print an Error message.static TLog
Creates new instance of TLog and uses class' simple name as a tagstatic TLog
Creates new instance of TLog with a specified taggetTag()
void
Print an Info message.void
Print a Warning message.
-
Method Details
-
forClass
Creates new instance of TLog and uses class' simple name as a tag- Parameters:
clazz
- class to create TLog for- Returns:
- new instance of TLog
-
forTag
Creates new instance of TLog with a specified tag- Parameters:
tag
- tag name, which will be added to every logged message. Allowed characters are [a-zA-Z0-9-_]- Returns:
- new instance of TLog
-
getTag
- Returns:
- tag used by this logger
-
d
Print a Debug message. Will do noting if current log level is set to INFO or higher.- Parameters:
message
- message which also acts as a template. %s in this string will be replaced with args in orderargs
- optional array of arguments. %s strings in the `message` will be replaced with the specified args in order. If the last argument is an instance of Throwable (usually an Exception), its description and stacktrace will be added to the end of the message and it won't act as an argument for %s- See Also:
-
i
Print an Info message. Will do noting if current log level is set to WARNING or higher.- Parameters:
message
- message which also acts as a template. %s in this string will be replaced with args in orderargs
- optional array of arguments. %s strings in the `message` will be replaced with the specified args in order. If the last argument is an instance of Throwable (usually an Exception), its description and stacktrace will be added to the end of the message and it won't act as an argument for %s- See Also:
-
w
Print a Warning message. Will do noting if current log level is set to ERROR or higher.- Parameters:
message
- message which also acts as a template. %s in this string will be replaced with args in orderargs
- optional array of arguments. %s strings in the `message` will be replaced with the specified args in order. If the last argument is an instance of Throwable (usually an Exception), its description and stacktrace will be added to the end of the message and it won't act as an argument for %s- See Also:
-
e
Print an Error message.- Parameters:
message
- message which also acts as a template. %s in this string will be replaced with args in orderargs
- optional array of arguments. %s strings in the `message` will be replaced with the specified args in order. If the last argument is an instance of Throwable (usually an Exception), its description and stacktrace will be added to the end of the message and it won't act as an argument for %s- See Also:
-