Package com.prineside.tdi2.utils.logging
Class Logger
java.lang.Object
com.prineside.tdi2.utils.logging.Logger
- Writes logs to a log writer specified by the platform (normally it is a log.txt)
- Makes sure to flush and close the log writer if app exits in a regular way
- Rotates logs at the start of the game or if they get too big
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final class
static interface
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
Must be accessible with Gdx.files.local(), not forced - just a suggestionstatic final int
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
addLogListener
(Logger.LogListener listener) static void
forceLogFileFlushAndRun
(Runnable onFlush) Flush log file asap and run something immediately on the log writer threadstatic TLog
static TLog
static String
getLastLogLines
(int lineCount) static PlatformLogger
static void
init
(ActionResolver actionResolver) static void
removeLogListener
(Logger.LogListener listener) static void
setLogFile
(FileHandle file) Set log file output and close the writer if it is openedstatic void
setPlatformLogger
(PlatformLogger platformLogger)
-
Field Details
-
DEFAULT_LOG_FILE_NAME
Must be accessible with Gdx.files.local(), not forced - just a suggestion- See Also:
-
MAX_TAG_SIZE
public static final int MAX_TAG_SIZE- See Also:
-
-
Method Details
-
forClass
-
forTag
-
init
-
forceLogFileFlushAndRun
Flush log file asap and run something immediately on the log writer thread- Parameters:
onFlush
- a piece of code to run once right after flush. Will be called on a separate thread.
-
addLogListener
-
removeLogListener
-
setLogFile
Set log file output and close the writer if it is opened- Parameters:
file
- file to write logs to, can be null
-
getPlatformLogger
-
setPlatformLogger
-
getLastLogLines
- Returns:
- last log lines, usually used for reports
-