public class LogRecord
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static interface |
LogRecord.OnNotEnoughSpaceListener
It will be called on, when has not enough storage space remaining.
|
Constructor and Description |
---|
LogRecord()
Initialize.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Close the Log file.
|
void |
disenableDateFormat()
Disenable add the head (Date-time information) when write log into Log file.
|
void |
enableDateFormat()
Enable add the head(Date-time information) when write log into Log file.
|
java.io.File |
getLogFile()
Returns the file name of the log file.
|
java.io.File |
getLogFileFolder()
Returns log file.
|
boolean |
hasRemaining()
Can it write in, after checking the storage space remaining?.
|
boolean |
init(java.lang.String folderPath,
java.lang.String fileName,
java.lang.String charset)
initialize.
|
void |
setCompressionMode(CompressionMode mode)
Setting the Compression Mode on a real-time saves Log.
|
void |
setMaxFileSize(long space,
SpaceUnit unit)
Setting the limit size of Log file.
|
void |
setOnNotEnoughSpaceListener(LogRecord.OnNotEnoughSpaceListener listener)
Register listener to receive events when not enough space.
|
void |
setSimpleDateFormat(java.lang.String format)
The Date format style of write log into Log file.
|
void |
write(java.lang.String str)
Will not have text wraps automatically when write the log into file.
|
void |
writeln(java.lang.String str)
Will have text wraps automatically when write the log into file.
|
public void setOnNotEnoughSpaceListener(LogRecord.OnNotEnoughSpaceListener listener)
listener
- listenerpublic void setSimpleDateFormat(java.lang.String format)
format
- The Date format stylepublic void enableDateFormat()
public void disenableDateFormat()
public void setCompressionMode(CompressionMode mode)
mode
- the file Compression Modepublic boolean init(java.lang.String folderPath, java.lang.String fileName, java.lang.String charset)
folderPath
- the Folder path of the LogfileName
- the file name of Logcharset
- The Character encoding of Log filepublic void close()
public void write(java.lang.String str)
str
- message of the log record.public void writeln(java.lang.String str)
str
- logpublic java.io.File getLogFile()
public java.io.File getLogFileFolder()
public void setMaxFileSize(long space, SpaceUnit unit)
space
- numbers in unitunit
- the unit of spacepublic boolean hasRemaining()