Package com.mckoi.util
Class Log
- java.lang.Object
-
- com.mckoi.util.Log
-
- Direct Known Subclasses:
NullLog
public class Log extends java.lang.Object
A log file/stream that logs some information generated by the system. This is intended to help with debugging. It safely handles concurrent output to the log.
-
-
Field Summary
Fields Modifier and Type Field Description private java.text.DateFormat
date_format
Date formatter.private LogWriter
log_output
The output stream where log information is output to.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Closes the log file.void
log(java.lang.String text)
Writes an entry to the log file.void
logln(java.lang.String text)
static Log
nullLog()
Returns a Log that won't actually store a log.
-
-
-
Field Detail
-
log_output
private final LogWriter log_output
The output stream where log information is output to.
-
date_format
private final java.text.DateFormat date_format
Date formatter.
-
-
Constructor Detail
-
Log
public Log(java.lang.String path) throws java.io.FileNotFoundException, java.io.IOException
- Throws:
java.io.FileNotFoundException
java.io.IOException
-
Log
public Log(java.io.File file, int size, int max_count) throws java.io.IOException
- Throws:
java.io.IOException
-
Log
public Log(java.io.File file) throws java.io.FileNotFoundException, java.io.IOException
- Throws:
java.io.FileNotFoundException
java.io.IOException
-
Log
protected Log()
-
-
Method Detail
-
log
public void log(java.lang.String text)
Writes an entry to the log file. The log file records the time the entry was put into the log, and the string which is the log.
-
logln
public void logln(java.lang.String text)
-
close
public void close()
Closes the log file.
-
nullLog
public static Log nullLog()
Returns a Log that won't actually store a log. This is useful for options where the user doesn't want anything logged.
-
-