Class LogWriter
- java.lang.Object
-
- java.io.Writer
-
- org.apache.sling.scripting.core.impl.LogWriter
-
- All Implemented Interfaces:
Closeable,Flushable,Appendable,AutoCloseable
public class LogWriter extends Writer
TheLogWriteris a simpleWriterwhich writes lines of data to a given SLF4J Logger. Data is gathered in an internal buffer until theflush()method is called or until a CR or LF character is encountered in the data to be written.
-
-
Constructor Summary
Constructors Constructor Description LogWriter(org.slf4j.Logger logger)Creates a writer based on the given logger.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Just callsflush()voidflush()Writes any data conained in the buffer to the logger as an error message.voidwrite(char[] cbuf, int off, int len)Writes the indicated characters to the internal buffer, flushing the buffer on any occurrence of a CR of LF.voidwrite(int c)Writes the character to the internal buffer unless the character is a CR or LF in which case the buffer is written to the logger as an error message.
-
-
-
Method Detail
-
write
public void write(int c)
Writes the character to the internal buffer unless the character is a CR or LF in which case the buffer is written to the logger as an error message.
-
write
public void write(char[] cbuf, int off, int len)Writes the indicated characters to the internal buffer, flushing the buffer on any occurrence of a CR of LF.
-
flush
public void flush()
Writes any data conained in the buffer to the logger as an error message.
-
-