|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.io.Writer
java.io.PrintWriter
org.objectweb.util.monolog.wrapper.printwriter.PrintWriterImpl
This class is a PrintWriter wrapper. It exports the PrintWriter methods but fowards the message to a Logger. This implementation bufferizes the data when a print method is used. The buffer and the data are always written when a println method is used. No end of line are inserted by the println methods. A line is equals to a monolog message.
Field Summary | |
protected java.lang.String |
currentLine
This field is the buffer which represents the current line. |
protected boolean |
errors
This field indicates the setError method was called. |
protected int |
level
|
protected Logger |
logger
The inner logger instance |
protected LoggerFactory |
loggerFactory
|
Fields inherited from class java.io.PrintWriter |
out |
Fields inherited from class java.io.Writer |
lock |
Constructor Summary | |
PrintWriterImpl(Logger l)
It builds a PrintWriterImpl instance. |
|
PrintWriterImpl(Logger l,
int level)
It builds a PrintWriterImpl instance. |
|
PrintWriterImpl(Logger logger,
LoggerFactory loggerFactory)
It builds a PrintWriterImpl instance. |
Method Summary | |
boolean |
checkError()
Flush the stream and check its error state. |
void |
close()
It writes the buffer if it is not empty |
void |
flush()
It writes the buffer if it is not empty |
int |
getLevel()
|
Logger |
getLogger()
Retrieves the logger instance used |
LoggerFactory |
getLoggerFactory()
Retrieves the logger factory instance used |
void |
print(boolean x)
Print a boolean value in the buffer. |
void |
print(char x)
Print a character in the buffer. |
void |
print(char[] x)
Print an array of characters in the buffer. |
void |
print(double x)
Print a double-precision floating-point number in the buffer. |
void |
print(float x)
Print a floating-point number in the buffer. |
void |
print(int x)
Print an integer in the buffer. |
void |
print(long x)
Print a long integer in the buffer. |
void |
print(java.lang.Object x)
Print an object in the buffer. |
void |
print(java.lang.String x)
Print a string in the buffer. |
void |
println()
Send the buffer to the logger |
void |
println(boolean x)
Send the buffer and a boolean value to the logger |
void |
println(char x)
Send the buffer and a character to the logger |
void |
println(char[] x)
Send the buffer and an array of characters to the logger |
void |
println(double x)
Send the buffer and a a double-precision floating-point number to the logger. |
void |
println(float x)
Send the buffer and a floating-point number to the logger |
void |
println(int x)
Send the buffer and an integer to the logger |
void |
println(long x)
Send the buffer and a long integer number to the logger |
void |
println(java.lang.Object x)
Send the buffer and an object to the logger |
void |
println(java.lang.String x)
Send the buffer and a String to the logger |
protected void |
setError()
Indicate that an error has occurred. |
void |
setLevel(int level)
|
void |
setLogger(Logger logger)
Assigns the logger instance to use |
void |
setLoggerFactory(LoggerFactory lf)
Assigns the logger factory instance to use |
void |
write(char[] buf)
Write an array of characters in the buffer. |
void |
write(char[] buf,
int off,
int len)
Write a portion of an array of characters in the buffer. |
void |
write(int c)
Write a single character in the buffer. |
void |
write(java.lang.String s)
Write a string in the buffer. |
void |
write(java.lang.String s,
int off,
int len)
Write a portion of a string in the buffer. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected Logger logger
protected LoggerFactory loggerFactory
protected int level
protected java.lang.String currentLine
protected boolean errors
Constructor Detail |
public PrintWriterImpl(Logger l) throws java.lang.NullPointerException
l
- is the logger toward which the message must be send
java.lang.NullPointerException
- if the parameter is null.public PrintWriterImpl(Logger logger, LoggerFactory loggerFactory) throws java.lang.NullPointerException
logger
- is the logger toward which the message must be sendloggerFactory
- is the loggerFactory of the logger
java.lang.NullPointerException
- if one of the parameters is null.public PrintWriterImpl(Logger l, int level) throws java.lang.NullPointerException
l
- is the logger toward which the message must be sendlevel
- is the level used to log message.
java.lang.NullPointerException
- if the parameter is null.Method Detail |
public int getLevel()
public void setLevel(int level)
public Logger getLogger()
getLogger
in interface Loggable
public void setLogger(Logger logger)
setLogger
in interface Loggable
public LoggerFactory getLoggerFactory()
getLoggerFactory
in interface Loggable
public void setLoggerFactory(LoggerFactory lf)
setLoggerFactory
in interface Loggable
public boolean checkError()
public void close()
public void flush()
public void print(boolean x)
public void print(char x)
public void print(char[] x)
public void print(double x)
public void print(float x)
public void print(int x)
public void print(long x)
public void print(java.lang.Object x)
public void print(java.lang.String x)
public void println()
public void println(boolean x)
public void println(char x)
public void println(char[] x)
public void println(double x)
public void println(float x)
public void println(int x)
public void println(long x)
public void println(java.lang.Object x)
public void println(java.lang.String x)
protected void setError()
public void write(char[] buf)
public void write(char[] buf, int off, int len)
public void write(int c)
public void write(java.lang.String s)
public void write(java.lang.String s, int off, int len)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |