NDEVR
API Documentation
AsciiFileOutputStreamfinal

A LogStream that writes log messages directly to a specified ASCII text file. More...

Inheritance diagram for AsciiFileOutputStream:
[legend]
Collaboration diagram for AsciiFileOutputStream:
[legend]

Public Member Functions

 AsciiFileOutputStream (const File &file, bool append)
 Constructs an AsciiFileOutputStream targeting the given file.
virtual ~AsciiFileOutputStream ()
 Destructor.
void addMessage (uint04 id, const LogMessage &message) final override
 Adds a single log message to the output file.
void addMessages (uint04 id, const Buffer< LogMessage > &messages) final override
 Adds multiple log messages to the output file in a batch.
void copyFile (File new_location)
 Copies the current log file to a new location on disk.
const Filefile () const
 Returns a reference to the current output file.
void moveFile (File new_location)
 Moves the current log file to a new location on disk.
void setFile (const File &file, bool append)
 Changes the target output file.
void setOnlyLogSession (bool only_log_session)
 Sets whether only messages from the current session should be logged.
void setProgress (uint04, fltp04) final override
 Sets progress information.
Public Member Functions inherited from LogStream
virtual ~LogStream ()
 Destructor.
virtual void addProgressSource (const TranslatedString &name, uint04 idx, fltp04 progress)
 Registers a new progress source to be tracked by this stream.
virtual void allowCancel (bool)
 Sets whether this stream allows the user to cancel an in-progress operation.
virtual void allowInput (bool)
 Sets whether this stream allows user input during an operation.
virtual void attach (InfoPipe *stream)
 Attaches this LogStream to the given InfoPipe so it receives log updates.
void clearLinks ()
 Detaches this LogStream from all linked InfoPipe objects and clears the link list.
virtual void detach (InfoPipe *stream)
 Detaches this LogStream from the given InfoPipe, stopping further updates from it.
bool ignoringMessages () const
 Returns whether this stream is currently ignoring messages.
virtual void removeProgressSource (uint04 idx)
 Removes a previously registered progress source from this stream.
void setIgnoreMessages (bool ignore)
 Sets whether this stream should ignore incoming messages.

Static Public Member Functions

static void ReadLogFile (LogPtr stream, const File &file)
 Reads log messages from an ascii file into a log stream.
static void WriteLogFile (LogPtr stream, const File &file)
 Writes all messages from a log stream to an ascii file.

Additional Inherited Members

Protected Attributes inherited from LogStream
bool m_ignore_message = false
 Whether this stream should ignore incoming messages.
Buffer< InfoPipe * > m_linked_logs
 Collection of InfoPipe objects this stream is listening to.
Dictionary< uint04, ProgressSourcem_progress_sources
 Maps progress source indices to their ProgressSource data.

Detailed Description

A LogStream that writes log messages directly to a specified ASCII text file.


Definition at line 44 of file AsciiFileOutputStream.h.

Constructor & Destructor Documentation

◆ AsciiFileOutputStream()

AsciiFileOutputStream::AsciiFileOutputStream ( const File & file,
bool append )
explicit

Constructs an AsciiFileOutputStream targeting the given file.

Parameters
[in]fileThe file to write log messages to.
[in]appendWhether to append to the existing file contents or overwrite.

References file().

◆ ~AsciiFileOutputStream()

virtual AsciiFileOutputStream::~AsciiFileOutputStream ( )
virtual

Destructor.

Flushes remaining messages and releases resources.

Member Function Documentation

◆ addMessage()

void AsciiFileOutputStream::addMessage ( uint04 id,
const LogMessage & message )
finaloverridevirtual

Adds a single log message to the output file.

Parameters
[in]idThe message identifier.
[in]messageThe log message to write.

Implements LogStream.

◆ addMessages()

void AsciiFileOutputStream::addMessages ( uint04 id,
const Buffer< LogMessage > & messages )
finaloverridevirtual

Adds multiple log messages to the output file in a batch.

Parameters
[in]idThe starting message identifier.
[in]messagesThe buffer of log messages to write.

Reimplemented from LogStream.

◆ copyFile()

void AsciiFileOutputStream::copyFile ( File new_location)

Copies the current log file to a new location on disk.

Parameters
[in]new_locationThe destination file path.

◆ file()

const File & AsciiFileOutputStream::file ( ) const

Returns a reference to the current output file.

Returns
A const reference to the File being written to.

Referenced by AsciiFileOutputStream(), ReadLogFile(), setFile(), and WriteLogFile().

◆ moveFile()

void AsciiFileOutputStream::moveFile ( File new_location)

Moves the current log file to a new location on disk.

Parameters
[in]new_locationThe destination file path.

◆ ReadLogFile()

void AsciiFileOutputStream::ReadLogFile ( LogPtr stream,
const File & file )
static

Reads log messages from an ascii file into a log stream.

Parameters
[in]streamThe log stream to populate with messages.
[in]fileThe file to read log messages from.

References file().

◆ setFile()

void AsciiFileOutputStream::setFile ( const File & file,
bool append )

Changes the target output file.

Parameters
[in]fileThe new file to write log messages to.
[in]appendWhether to append to the existing file contents or overwrite.

References file().

◆ setOnlyLogSession()

void AsciiFileOutputStream::setOnlyLogSession ( bool only_log_session)

Sets whether only messages from the current session should be logged.

Parameters
[in]only_log_sessionIf true, only current session messages are written.

◆ setProgress()

void AsciiFileOutputStream::setProgress ( uint04 ,
fltp04  )
inlinefinaloverridevirtual

Sets progress information.

No-op for this stream.

Parameters
[in]idThe progress identifier.
[in]progressThe progress value between 0 and 1.

Implements LogStream.

Definition at line 62 of file AsciiFileOutputStream.h.

◆ WriteLogFile()

void AsciiFileOutputStream::WriteLogFile ( LogPtr stream,
const File & file )
static

Writes all messages from a log stream to an ascii file.

Parameters
[in]streamThe log stream containing messages to write.
[in]fileThe file to write the log messages to.

References file().


The documentation for this class was generated from the following file: