#include <TaskServices.h>
Public Member Functions | |
TaskServices () | |
virtual | ~TaskServices () |
virtual Logging::Logger::LoggerSmartPtr | getLogger () |
Private Attributes | |
Logging::Logger::LoggerSmartPtr | m_logger |
The TaskServices class is the base class for all task services, i.e. services that are needed/used by a task. ACS tasks (e.g. tasks which extend parameterTask) can use this class as-is by linking with the parameterTask library, which in turn links with the standard ACS logging library, liblogging. This introduces dependencies on ACE/TAO which may be undesirable in some cases. In cases where dependencies on ACE/TAO are undesirable, decoupling can be achieved in the following way(s):
1) Add the following to your code which initializes things (top of main() for example): include <loggingGenericLogger.h>
if (Logging::Logger::getGlobalLogger() == 0) { Logging::Logger::setGlobalLogger(new Logging::GenericLogger(Logging::BaseLog::GLOBAL_LOGGER_NAME)); }
Another option is to set the global Logger to be a subclass of Logger that you have written.
2) link with the baselogging library instead of the logging library (or instead of the parameterTask library which links with the logging library)
In so doing, you would then be completely decoupled from ACE/TAO for the purposes of logging.
So, to summarize:
-> To use this class in an ACS-aware manner, you need only to link with the parameterTask library (or the logging library) and use the standard ACS_XYZ logging macros.
-> To use this class in an ACS-decoupled manner, you must avoid linking with parameterTask (and/or the logging library), instead linking with the baselogging library and setting your own global logger using the Logging::Logger::setGlobalLogger static method. Additionally, you will currently be limited to using macros defined in loggingMACROS.h.
ACS::TaskServices::TaskServices | ( | ) | [inline] |
Constructor, which creates the logger.
References getNamedLogger(), m_logger, and ACS::TASK_LOGGER_NAME.
virtual ACS::TaskServices::~TaskServices | ( | ) | [inline, virtual] |
Destructor, which must be virtual.
virtual Logging::Logger::LoggerSmartPtr ACS::TaskServices::getLogger | ( | ) | [inline, virtual] |
The method to acquire a logger for the task.
Referenced by TaskServices().