Library of Assembled Shared Sources
lass::io::Logger Class Reference

Logs proxy streams to files. More...

#include <logger.h>

Public Member Functions

 Logger (const std::string &iLogFile, LogMode iLogMode=lmClear)
 Default constructor for the sake of static library.
 
 ~Logger ()
 Unsubscribe to all proxys.
 
void subscribeTo (ProxyOStream *iProxy, TMask iFilter=ProxyOStream::acceptAll)
 Subscribe this logger to a proxy stream and set the filter on it.
 
void unsubscribeTo (ProxyOStream *iProxy)
 Unsubscribe this logger to a proxy stream.
 
TMask filter (ProxyOStream *iProxy)
 return the filter between proxy and logger
 
void setFilter (ProxyOStream *iProxy, TMask iFilter)
 Set filter between proxy and logger.
 

Detailed Description

Logs proxy streams to files.

Date
2003

Construct a logger and subscribe it to proxy streams so it can log them. All output to all proxy streams it is subscribed to will be saved to a file. Per proxy stream you can set a filter of what messages should be logged. The logger will unsubscribe itself on destruction.

Logger logger("logfile.txt"); // construct logger\n
logger.subscribe(proxyOut()); // subsribe to the proxy out stream.\n
...\n
logger.unsubscribe(proxyOut());\n
Logger(const std::string &iLogFile, LogMode iLogMode=lmClear)
Default constructor for the sake of static library.
Definition logger.cpp:62

Definition at line 80 of file logger.h.

Constructor & Destructor Documentation

◆ Logger()

lass::io::Logger::Logger ( const std::string & iLogFilename,
LogMode iLogMode = lmClear )

Default constructor for the sake of static library.

We don't recommend of using it. Create a logger to a log file and specify if it must append to the file or clear it.

Definition at line 62 of file logger.cpp.

Member Function Documentation

◆ subscribeTo()

void lass::io::Logger::subscribeTo ( ProxyOStream * iProxy,
TMask iFilter = ProxyOStream::acceptAll )

Subscribe this logger to a proxy stream and set the filter on it.

Parameters
iProxyif null pointer, then an exception is thrown.
iFilterfilter between proxy and logger

Definition at line 86 of file logger.cpp.

References lass::io::ProxyOStream::add().

◆ unsubscribeTo()

void lass::io::Logger::unsubscribeTo ( ProxyOStream * iProxy)

Unsubscribe this logger to a proxy stream.

Parameters
iProxyif null pointer, then an exception is thrown.

Definition at line 97 of file logger.cpp.

References lass::io::ProxyOStream::remove().

◆ filter()

Logger::TMask lass::io::Logger::filter ( ProxyOStream * iProxy)

return the filter between proxy and logger

Parameters
iProxylogger must be subscribed to this proxy (and proxy should not be a NULL pointer), otherwise and exception is thrown.

Definition at line 109 of file logger.cpp.

◆ setFilter()

void lass::io::Logger::setFilter ( ProxyOStream * iProxy,
TMask iFilter )

Set filter between proxy and logger.

Parameters
iProxylogger must be subscribed to this proxy (and proxy should not be a NULL pointer), otherwise and exception is thrown.
iFilterthe filter between proxy and logger.

Definition at line 121 of file logger.cpp.

References setFilter().

Referenced by setFilter().


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