|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.jogre.common.util.JogreLogger
Custom logging was created for JOGRE so that is as flexible and as lightweight as possible (e.g. log4j is too large at 345kb). This logging stores a timestamp, followed by the class and then the message itself.
To use this class you simply create a new instance at the top of a class such as:
JogreLogger logger = new JogreLog (this.getClass());
To use this class in source code use the log (String message), error (String method, String message), info (String method, String message) and debug (String method, String message) methods. The error method should be used when there is simply an error (used for speed), logInfo for logging information (on a stable system) and logDebug (slower) for debugging an application (logs everything).
To see the priority of debug output at run time by setting the following key/value properties in a "game.properties" file. All of these properties are optional and if they don't exist then their default values are assumed (which are in bold).
log.priority.console
- must be equal to one of the following:1
- error (fast, but only logs errors.2
- info - (medium speend, logs information strings).3
- debug - (slow, logs everything.log.priority.file
- must be equal to one of the following:1
- error (fast, but only logs errors.2
- info - (medium speend, logs information strings).3
- debug - (slow, logs everything.log.show.priority
- true
or false
- show priority in log outputs.Logs which are saved by file are saved in the following location - "logs/yyyy_MM/log_dd_MMM_yyyy.txt" where y = year, d = day and M = month e.g. "logs/2004_04/log_29_April_2004.txt". This logger is not anywhere near as efficient as others but this will be investigated soon.
Field Summary | |
protected String |
className
Name of this class. |
protected int |
consolePriority
Priority of console logging. |
protected int |
filePriority
Priority of file logging. |
protected boolean |
showPriority
If this is true then show the priority of the log as a String. |
Fields inherited from interface org.jogre.common.util.IJogreLog |
DEBUG, DEFAULT_CONSOLE_PRIORITY, DEFAULT_FILE_PRIORITY, DEFAULT_SHOW_PRIORITY, ERROR, INFO, NONE, PRIORITY_STRS |
Constructor Summary | |
JogreLogger(Class loggedClass)
Constructor which takes the class of the logged Class. |
Method Summary | |
void |
debug(String method,
String message)
Log a debug message. |
void |
error(String method,
String message)
Log an error message. |
void |
info(String method,
String message)
Log an information message. |
void |
log(String message)
Simple log which will go in at INFO level. |
void |
stacktrace(Exception e)
Logs a stacktrace. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected String className
protected int consolePriority
protected int filePriority
protected boolean showPriority
Constructor Detail |
public JogreLogger(Class loggedClass)
loggedClass
- Method Detail |
public void error(String method, String message)
method
- Method in a class.message
- Message to log.public void info(String method, String message)
method
- Method in a class.message
- Message to log.public void debug(String method, String message)
method
- Method in a class.message
- Message to log.public void log(String message)
message
- Message to logpublic void stacktrace(Exception e)
e
- Exception object.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |