net.mtu.eggplant.io
Class LogWriter

java.lang.Object
  extended by java.io.Writer
      extended by net.mtu.eggplant.io.LogWriter
All Implemented Interfaces:
Closeable, Flushable, Appendable

public class LogWriter
extends Writer

Writer that outputs to the current logging facility (SLF4J).


Nested Class Summary
static class LogWriter.LogLevel
          Log levels that LogWriter can output to.
 
Field Summary
 
Fields inherited from class java.io.Writer
lock
 
Constructor Summary
LogWriter(Logger logger, LogWriter.LogLevel level)
           
LogWriter(Object lock, Logger logger, LogWriter.LogLevel level)
           
 
Method Summary
 void close()
           
 void flush()
           
 void write(char[] cbuf, int off, int len)
           
 
Methods inherited from class java.io.Writer
append, append, append, write, write, write, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LogWriter

public LogWriter(Logger logger,
                 LogWriter.LogLevel level)
Parameters:
logger - the logger to log to
level - the level to log at
Throws:
NullPointerException - if logger or level is null

LogWriter

public LogWriter(Object lock,
                 Logger logger,
                 LogWriter.LogLevel level)
Parameters:
lock - the lock
logger - the logger to log to
level - the level to log at
Throws:
NullPointerException - if logger or level is null
Method Detail

close

public void close()
           throws IOException
Specified by:
close in interface Closeable
Specified by:
close in class Writer
Throws:
IOException
See Also:
Writer.close()

flush

public void flush()
           throws IOException
Specified by:
flush in interface Flushable
Specified by:
flush in class Writer
Throws:
IOException
See Also:
Writer.flush()

write

public void write(char[] cbuf,
                  int off,
                  int len)
           throws IOException
Specified by:
write in class Writer
Throws:
IOException
See Also:
Writer.write(char[], int, int)