fawkes::LoggerFactory Class Reference
Logger factory. More...
#include <utils/logging/factory.h>
Static Public Member Functions | |
| static Logger * | instance (const char *type, const char *as) |
| Get logger instance. | |
| static MultiLogger * | multilogger_instance (const char *as) |
| Create MultiLogger instance. | |
| template<class L > | |
| static L * | instance (const char *type, const char *as) |
| Get typed instance of logger. | |
Detailed Description
Logger factory.This logging factory provides access to all loggers in a unified way. You just supply a logger argument string and depending on the logger type an instance of the desired logger is returned or otherwise an exception is thrown. See instance() for a list of supported logger types.
Definition at line 44 of file factory.h.
Member Function Documentation
| static L* fawkes::LoggerFactory::instance | ( | const char * | type, | |
| const char * | as | |||
| ) | [inline, static] |
Get typed instance of logger.
Creates a new instance and converts it to the requested type. If the type does not match the requested logger an exception is thrown.
- Parameters:
-
type logger type as logger argument string
- Returns:
- typed logger instance
- Exceptions:
-
TypeMismatchException thrown, if requested logger does not match requested type.
| L * fawkes::LoggerFactory::instance | ( | const char * | type, | |
| const char * | as | |||
| ) | [inline, static] |
Get logger instance.
Get an instance of a logger of the given type. The argument string is used for logger arguments. Supported logger types:
- console, ConsoleLogger
- file, FileLogger NOT supported:
- NetworkLogger, needs a FawkesNetworkHub which cannot be passed by parameter
- Parameters:
-
type logger type as logger argument string
- Returns:
- logger instance of requested type
- Exceptions:
-
UnknownLoggerTypeException thrown, if the desired logger could not be instantiated. This could be a misspelled logger type.
Definition at line 74 of file factory.cpp.
Referenced by multilogger_instance().
| MultiLogger * fawkes::LoggerFactory::multilogger_instance | ( | const char * | as | ) | [static] |
Create MultiLogger instance.
This creates a multi logger instance based on the supplied argument string. The argument string is of the form
ltype:largs[;ltype2:largs2[;...]]
- Parameters:
-
as logger argument string
- Returns:
- multi logger instance with requested loggers
- Exceptions:
-
UnknownLoggerTypeException thrown if any of the loggers was unknown.
Definition at line 115 of file factory.cpp.
References fawkes::MultiLogger::add_logger(), fawkes::Exception::append(), and instance().
The documentation for this class was generated from the following files:
- src/libs/utils/logging/factory.h
- src/libs/utils/logging/factory.cpp

