# GenericLogPrinter< T > Class Template Reference

GenericLogPrinter abstract class. More...

`#include <GenericLogPrinter.h>`

Inheritance diagram for GenericLogPrinter< T >:

List of all members.

## Public Member Functions
void | AddLogManager (ILogManager *logManager)
| Adds the ILogManager instance to m_LogManagers vector.
void | PrintMessage (const LogInfo &logInfo, const CompositeLoggable &message)
| Prints the formatted message on all registered ILogManagers.
## Private Member Functions
virtual T | DoFormatMessage (const LogInfo &logInfo, const CompositeLoggable &message)=0
| Format the provided message into T.
## Private Attributes
std::vector < IGenericLogManager< T > * > | m_LogManagers
| Contains all IGenericLogManagers connected to this GenericLogPrinter.
## Friends
class | Nvidia::Logging::Test::LoggerTest
class | Nvidia::Logging::Test::LoggerConstructorTest

## Detailed Description

### template<typename T>
class Nvidia::Logging::GenericLogPrinter< T >

GenericLogPrinter abstract class.

Objects of this class are responsible for formatting messages provided by the Logger into a custom format and type, suitable for transferring into the LogManager.

Template Parameters:

  | T | Type of the result of message formatting.

Definition at line 42 of file GenericLogPrinter.h.

## Member Function Documentation

void AddLogManager | ( | ILogManager * | logManager | ) | `[inline, virtual]`

Adds the ILogManager instance to m_LogManagers vector.

It's not the GenericLogPrinter, but the Logger that maintains the life cycle of the ILogManager instances. This is because ILogManager instances can be shared between different ILogPrinters.

Exceptions:

  | std::bad_cast | If this GenericLogPrinter is incompatible with the provided ILogManager instance (i.e. it's not a IGenericLogManager or the template parameters don't match).

Implements ILogPrinter.

Definition at line 61 of file GenericLogPrinter.h.

virtual T DoFormatMessage | ( | const LogInfo & | logInfo,
|  | const CompositeLoggable & | message |
| ) |  |  | `[private, pure virtual]`

Format the provided message into T.

This method has been renamed from FormatMessage due to name clash with a macro defined in windows.h.

Implemented in SimpleTextLogPrinter, and XMLLogPrinter.

Referenced by GenericLogPrinter< std::tstring >::PrintMessage().

void PrintMessage | ( | const LogInfo & | logInfo,
|  | const CompositeLoggable & | message |
| ) |  |  | `[inline, virtual]`

Prints the formatted message on all registered ILogManagers.

Implementation first calls DoFormatMessage() to format the message, and then passes the formatted message via ManageMessage method to every IGenericLogManager from m_LogManagers vector .

Implements ILogPrinter.

Definition at line 76 of file GenericLogPrinter.h.

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

- GenericLogPrinter.h