NDEVR
API Documentation
LogManager

A class that has any number of children that also feed into the log. More...

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

Public Types

enum  MoveMode { e_move , e_copy , e_ignore }
 Defines how existing log data is handled when changing log paths. More...

Public Member Functions

void addInput (const StringView &s) final override
 Adds user input text to the default input guard.
void addInput (const StringView &s, uint04 idx) final override
 Adds user input text associated with a specific input guard index.
void addLog (const StringView &name, InfoPipe *info)
 Registers a named log pipe with this manager.
virtual void addMessage (uint04 id, const LogMessage &) override
 Adds a structured log message to all child logs.
virtual void addMessage (uint04 id, const StringView &, uint01=10) override
 Adds a raw string message to all child logs.
virtual void addMessage (uint04 id, const TranslatedString &, uint01=10) override
 Adds a translated string message to all child logs.
virtual void addMessages (uint04 id, const Buffer< LogMessage > &) override
 Adds multiple log messages to all child logs in a batch.
void addStream (LogStream *stream, bool add_all) override
 Adds a log stream to this manager and optionally to all child logs.
InfoPipe * defaultLog () const
 Retrieves the default log pipe named "DEFAULT".
InfoPipe * getLog (const StringView &log_name) const
 Retrieves the log pipe associated with the given name.
bool hasLog (const StringView &log_name) const
 Checks whether a log with the given name exists in this manager.
const Dictionary< String, InfoPipe * > & logs ()
 Returns a reference to the dictionary of all registered logs.
void logStartupInformation (const StringView &log) const
 Logs system startup information such as environment and version details.
fltp04 progressIdx (uint04 idx) const final override
 Gets the progress percentage for a specific progress source.
void readFromFile (BinaryFile &file, uint08 version_number)
 Reads log data from a binary file.
void removeStream (LogStream *stream) override
 Removes a log stream from this manager and all child logs.
void requestCancel () override
 Requests cancellation of all ongoing operations across all child logs.
virtual void requestCancel (uint04 idx) override
 Requests cancellation of a specific operation by index across all child logs.
void setDefaultAsciiLogPath (const File &file, MoveMode mode)
 Sets the default file path for ASCII log output, optionally moving or copying existing data.
void setProgressIdx (uint04 idx, fltp04 percent) final override
 Sets the progress percentage for a specific progress source across all child logs.
void writeToFile (BinaryFile &file, uint01 minimum_log_level, CompressionMode mode=CompressionMode::e_default_compression)
 Writes all log messages at or above the given level to a binary file.

Private Member Functions

uint04 addCancelGuard (const TranslatedString &name) final override
 Adds a new cancel guard with the given name.
void addCancelGuard (const TranslatedString &name, uint04 idx) final override
 Adds a cancel guard at a specific index.
uint04 addInputGuard (const TranslatedString &name) final override
 Adds a new input guard with the given name.
void addInputGuard (const TranslatedString &name, uint04 idx) final override
 Adds an input guard at a specific index.
uint04 addProgressSource (const TranslatedString &name, fltp04 progress) final override
 Registers a new progress source with the given name and initial progress.
void addProgressSource (const TranslatedString &name, uint04 idx, fltp04 progress) final override
 Registers a progress source at a specific index.
bool cancelRequested () const final override
 Checks whether any cancellation has been requested across all child logs.
bool cancelRequestedIdx (uint04 idx) const final override
 Checks whether cancellation has been requested for a specific index.
void clearInputIdx (uint04 idx) final override
 Clears the stored input text for a specific input guard index.
void getInputIdx (String &s, uint04 idx, bool clear) final override
 Retrieves user input text for a specific input guard index.
void removeCancelGuard (uint04 idx) final override
 Removes a cancel guard by index from all child logs.
void removeInputGuard (uint04 idx) final override
 Removes an input guard by index from all child logs.
void removeProgressSource (uint04 idx) final override
 Removes a progress source by index from all child logs.

Detailed Description

A class that has any number of children that also feed into the log.


Can be used to easily collect logs from a variaty of different streams.

See also
LogStream, Log

Definition at line 14 of file LogManager.h.

Member Enumeration Documentation

◆ MoveMode

Defines how existing log data is handled when changing log paths.

Enumerator
e_move 

Move existing log data to the new location.

e_copy 

Copy existing log data to the new location.

e_ignore 

Discard existing log data when switching locations.

Definition at line 20 of file LogManager.h.

Member Function Documentation

◆ addCancelGuard() [1/2]

uint04 LogManager::addCancelGuard ( const TranslatedString & name)
finaloverrideprivatevirtual

Adds a new cancel guard with the given name.

Parameters
[in]nameThe display name of the cancel guard.
Returns
The index assigned to the new cancel guard.

Implements InfoPipe.

◆ addCancelGuard() [2/2]

void LogManager::addCancelGuard ( const TranslatedString & name,
uint04 idx )
finaloverrideprivatevirtual

Adds a cancel guard at a specific index.

Parameters
[in]nameThe display name of the cancel guard.
[in]idxThe index to assign.

Implements InfoPipe.

◆ addInput() [1/2]

void LogManager::addInput ( const StringView & s)
finaloverridevirtual

Adds user input text to the default input guard.

Parameters
[in]sThe input string to add.

Implements InfoPipe.

◆ addInput() [2/2]

void LogManager::addInput ( const StringView & s,
uint04 idx )
finaloverridevirtual

Adds user input text associated with a specific input guard index.

Parameters
[in]sThe input string to add.
[in]idxThe index of the input guard.

Implements InfoPipe.

◆ addInputGuard() [1/2]

uint04 LogManager::addInputGuard ( const TranslatedString & name)
finaloverrideprivatevirtual

Adds a new input guard with the given name.

Parameters
[in]nameThe display name of the input guard.
Returns
The index assigned to the new input guard.

Implements InfoPipe.

References addInputGuard().

Referenced by addInputGuard(), and addInputGuard().

◆ addInputGuard() [2/2]

void LogManager::addInputGuard ( const TranslatedString & name,
uint04 idx )
finaloverrideprivatevirtual

Adds an input guard at a specific index.

Parameters
[in]nameThe display name of the input guard.
[in]idxThe index to assign.

Implements InfoPipe.

References addInputGuard().

◆ addLog()

void LogManager::addLog ( const StringView & name,
InfoPipe * info )

Registers a named log pipe with this manager.

Parameters
[in]nameThe name to associate with the log.
[in]infoThe InfoPipe to register.

◆ addMessage() [1/3]

virtual void LogManager::addMessage ( uint04 id,
const LogMessage &  )
overridevirtual

Adds a structured log message to all child logs.

Parameters
[in]idThe identifier for the message source.
[in]messageThe log message to add.

Implements InfoPipe.

◆ addMessage() [2/3]

virtual void LogManager::addMessage ( uint04 id,
const StringView & ,
uint01 = 10 )
overridevirtual

Adds a raw string message to all child logs.

Parameters
[in]idThe identifier for the message source.
[in]messageThe string message to add.
[in]log_levelThe severity level of the message.

Implements InfoPipe.

◆ addMessage() [3/3]

virtual void LogManager::addMessage ( uint04 id,
const TranslatedString & ,
uint01 = 10 )
overridevirtual

Adds a translated string message to all child logs.

Parameters
[in]idThe identifier for the message source.
[in]messageThe translated message to add.
[in]log_levelThe severity level of the message.

Implements InfoPipe.

◆ addMessages()

virtual void LogManager::addMessages ( uint04 id,
const Buffer< LogMessage > &  )
overridevirtual

Adds multiple log messages to all child logs in a batch.

Parameters
[in]idThe identifier for the message source.
[in]messagesThe buffer of log messages to add.

◆ addProgressSource() [1/2]

uint04 LogManager::addProgressSource ( const TranslatedString & name,
fltp04 progress )
finaloverrideprivatevirtual

Registers a new progress source with the given name and initial progress.

Parameters
[in]nameThe display name of the progress source.
[in]progressThe initial progress value.
Returns
The index assigned to the new progress source.

Implements InfoPipe.

◆ addProgressSource() [2/2]

void LogManager::addProgressSource ( const TranslatedString & name,
uint04 idx,
fltp04 progress )
finaloverrideprivatevirtual

Registers a progress source at a specific index.

Parameters
[in]nameThe display name of the progress source.
[in]idxThe index to assign.
[in]progressThe initial progress value.

Implements InfoPipe.

◆ addStream()

void LogManager::addStream ( LogStream * stream,
bool add_all )
overridevirtual

Adds a log stream to this manager and optionally to all child logs.

Parameters
[in]streamThe log stream to add.
[in]add_allIf true, the stream is also added to all child logs.

Reimplemented from InfoPipe.

◆ cancelRequested()

bool LogManager::cancelRequested ( ) const
finaloverrideprivatevirtual

Checks whether any cancellation has been requested across all child logs.

Returns
True if any cancel request is active.

Implements InfoPipe.

◆ cancelRequestedIdx()

bool LogManager::cancelRequestedIdx ( uint04 idx) const
finaloverrideprivatevirtual

Checks whether cancellation has been requested for a specific index.

Parameters
[in]idxThe index of the cancel guard to check.
Returns
True if cancellation was requested for the given index.

Implements InfoPipe.

◆ clearInputIdx()

void LogManager::clearInputIdx ( uint04 idx)
finaloverrideprivatevirtual

Clears the stored input text for a specific input guard index.

Parameters
[in]idxThe index of the input guard to clear.

Implements InfoPipe.

References clearInputIdx().

Referenced by clearInputIdx().

◆ defaultLog()

InfoPipe * LogManager::defaultLog ( ) const
inline

Retrieves the default log pipe named "DEFAULT".

Returns
A pointer to the default InfoPipe.

Definition at line 42 of file LogManager.h.

References getLog().

◆ getInputIdx()

void LogManager::getInputIdx ( String & s,
uint04 idx,
bool clear )
finaloverrideprivatevirtual

Retrieves user input text for a specific input guard index.

Parameters
[in]sThe string to populate with the input value.
[in]idxThe index of the input guard.
[in]clearIf true, clears the stored input after retrieval.

Reimplemented from InfoPipe.

References getInputIdx().

Referenced by getInputIdx().

◆ getLog()

InfoPipe * LogManager::getLog ( const StringView & log_name) const

Retrieves the log pipe associated with the given name.

Parameters
[in]log_nameThe name of the log to retrieve.
Returns
A pointer to the InfoPipe for the specified log, or nullptr if not found.

Referenced by defaultLog(), BuildActionProgramLogic::executeMenuItems(), and BuildActionProgramLogic::setTreeWidgetsForSelection().

◆ hasLog()

bool LogManager::hasLog ( const StringView & log_name) const

Checks whether a log with the given name exists in this manager.

Parameters
[in]log_nameThe name of the log to look up.
Returns
True if a log with the specified name is registered, false otherwise.

◆ logs()

const Dictionary< String, InfoPipe * > & LogManager::logs ( )

Returns a reference to the dictionary of all registered logs.

Returns
A const reference to the dictionary mapping log names to InfoPipe pointers.

◆ logStartupInformation()

void LogManager::logStartupInformation ( const StringView & log) const

Logs system startup information such as environment and version details.

Parameters
[in]logThe name of the log to write startup information to.

◆ progressIdx()

fltp04 LogManager::progressIdx ( uint04 idx) const
finaloverridevirtual

Gets the progress percentage for a specific progress source.

Parameters
[in]idxThe index of the progress source.
Returns
The current progress value from 0.0 to 1.0.

Reimplemented from InfoPipe.

◆ readFromFile()

void LogManager::readFromFile ( BinaryFile & file,
uint08 version_number )

Reads log data from a binary file.

Parameters
[in]fileThe binary file to read from.
[in]version_numberThe format version number for deserialization.

◆ removeCancelGuard()

void LogManager::removeCancelGuard ( uint04 idx)
finaloverrideprivatevirtual

Removes a cancel guard by index from all child logs.

Parameters
[in]idxThe index of the cancel guard to remove.

Implements InfoPipe.

◆ removeInputGuard()

void LogManager::removeInputGuard ( uint04 idx)
finaloverrideprivatevirtual

Removes an input guard by index from all child logs.

Parameters
[in]idxThe index of the input guard to remove.

Implements InfoPipe.

References removeInputGuard().

Referenced by removeInputGuard().

◆ removeProgressSource()

void LogManager::removeProgressSource ( uint04 idx)
finaloverrideprivatevirtual

Removes a progress source by index from all child logs.

Parameters
[in]idxThe index of the progress source to remove.

Implements InfoPipe.

◆ removeStream()

void LogManager::removeStream ( LogStream * stream)
overridevirtual

Removes a log stream from this manager and all child logs.

Parameters
[in]streamThe log stream to remove.

Reimplemented from InfoPipe.

◆ requestCancel()

virtual void LogManager::requestCancel ( uint04 idx)
overridevirtual

Requests cancellation of a specific operation by index across all child logs.

Parameters
[in]idxThe index of the cancel guard to trigger.

Implements InfoPipe.

◆ setDefaultAsciiLogPath()

void LogManager::setDefaultAsciiLogPath ( const File & file,
MoveMode mode )

Sets the default file path for ASCII log output, optionally moving or copying existing data.

Parameters
[in]fileThe file path for ASCII log output.
[in]modeDetermines how existing log data is handled.

◆ setProgressIdx()

void LogManager::setProgressIdx ( uint04 idx,
fltp04 percent )
finaloverridevirtual

Sets the progress percentage for a specific progress source across all child logs.

Parameters
[in]idxThe index of the progress source.
[in]percentThe progress value from 0.0 to 1.0.

Implements InfoPipe.

◆ writeToFile()

void LogManager::writeToFile ( BinaryFile & file,
uint01 minimum_log_level,
CompressionMode mode = CompressionMode::e_default_compression )

Writes all log messages at or above the given level to a binary file.

Parameters
[in]fileThe binary file to write to.
[in]minimum_log_levelThe minimum severity level of messages to include.
[in]modeThe compression mode to use when writing.

References e_default_compression.


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