Protected Member Functions | Private Member Functions

ForwardToGlobalLogger Class Reference

Defines a policy to apply when the Logger fails to process a Message, namely, forward it to GlobalLogger. More...

#include <keyvalue/sys/logger/policy/ForwardToGlobalLogger.h>

Inheritance diagram for ForwardToGlobalLogger:
Inheritance graph
[legend]

List of all members.

Protected Member Functions

bool apply (const Logger *logger, const Message &message) const
 Applies ForwardToGlobalLogger policy.

Private Member Functions

void forward (const Logger *logger, const Message &message) const
 Forwards a Message to GlobalLogger.

Detailed Description

Defines a policy to apply when the Logger fails to process a Message, namely, forward it to GlobalLogger.

If the GlobalLogger is the one that fails, it is very likely that it can no longer receive Messages. For that reason, this policy resets GlobalLogger to its default(which supposedly never fails) before the forwarding.


Member Function Documentation

bool apply ( const Logger logger,
const Message message 
) const [protected]

Applies ForwardToGlobalLogger policy.

Returns:
This method returns false to indicate the previous failure.
void forward ( const Logger logger,
const Message message 
) const [private]

Forwards a Message to GlobalLogger.

This method receives a (raw) pointer to the Logger that has failed. If this pointer points to GlobalLogger's current registered Logger, then this method resets the GlobalLogger to its default Logger (which supposedly never fails).

Parameters:
logger : A pointer to the Logger which has failed;
message : The message to be forwarded.