org.apache.maven.shared.scriptinterpreter
Class FileLogger

java.lang.Object
  extended by org.apache.maven.shared.scriptinterpreter.FileLogger
All Implemented Interfaces:
ExecutionLogger

public class FileLogger
extends Object
implements ExecutionLogger

Version:
$Id: FileLogger.java 1194996 2011-10-29 19:42:00Z olamy $

Constructor Summary
FileLogger(File outputFile)
          Creates a new logger that writes to the specified file.
FileLogger(File outputFile, Log log)
          Creates a new logger that writes to the specified file and optionally mirrors messages to the given mojo logger.
 
Method Summary
 void close()
          Closes the underlying file stream.
 void consumeLine(String line)
          Writes the specified line to the log file and optionally to the mojo logger.
protected  void finalize()
          Closes the underlying file stream.
 File getOutputFile()
          Gets the path to the output file.
 PrintStream getPrintStream()
          Gets the underlying stream used to write message to the log file.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileLogger

public FileLogger(File outputFile)
           throws IOException
Creates a new logger that writes to the specified file.

Parameters:
outputFile - The path to the output file, must not be null.
Throws:
IOException - If the output file could not be created.

FileLogger

public FileLogger(File outputFile,
                  Log log)
           throws IOException
Creates a new logger that writes to the specified file and optionally mirrors messages to the given mojo logger.

Parameters:
outputFile - The path to the output file, must not be null.
log - The mojo logger to additionally output messages to, may be null if not used.
Throws:
IOException - If the output file could not be created.
Method Detail

getOutputFile

public File getOutputFile()
Gets the path to the output file.

Returns:
The path to the output file, never null.

getPrintStream

public PrintStream getPrintStream()
Gets the underlying stream used to write message to the log file.

Specified by:
getPrintStream in interface ExecutionLogger
Returns:
The underlying stream used to write message to the log file, never null.

consumeLine

public void consumeLine(String line)
Writes the specified line to the log file and optionally to the mojo logger.

Specified by:
consumeLine in interface ExecutionLogger
Parameters:
line - The message to log.

close

public void close()
Closes the underlying file stream.


finalize

protected void finalize()
Closes the underlying file stream.

Overrides:
finalize in class Object


Copyright © 2002-2012 The Apache Software Foundation. All Rights Reserved.