/** \file
 *
 *  Contains the TextLogWriter class definition.
 *
 *  Copyright (c) 2007,2008,2009 MBARI
 *  MBARI Proprietary Information.  All Rights Reserved
 *
 */

#ifndef TEXTLOGWRITER_H_
#define TEXTLOGWRITER_H_

#include "LogWriter.h"

class OutStream;

/**
 *  Defines a simple LogWriter that takes LogEntries and serializes them as
 *  text values to a stream.
 *
 *  See FileLogWriter for output to the filesystem.
 *
 *  \ingroup logging
 */
class TextLogWriter : public LogWriter
{
public:
    /** Default Constructor
     * Assumes that the stream will be assigned later via setOutStream()
     *
     * \param withDirectory If true, include DirectoryEntry entries.
     */
    TextLogWriter( bool withDirectory = false );

    /** Constructor, takes an OutStream.
     *
     * \param stream An OutStream for output.
     * \param withDirectory If true, include DirectoryEntry entries.
     */
    TextLogWriter( OutStream &stream, bool withDirectory = false );

    /// Destructor.
    virtual ~TextLogWriter();

    /// Start the text log
    virtual unsigned int writeHeader();

    /// Write an entry to the text log
    virtual unsigned int write( const LogEntry *entry, const Unit* unit = NULL );

private:

    bool withDirectory_;

};

#endif /*TEXTLOGWRITER_H_*/
