logger.cpp

00001 
00002 /***************************************************************************
00003  *  logger.cpp - Logger aspect for Fawkes
00004  *
00005  *  Created: Wed Feb 11 22:21:56 2009
00006  *  Copyright  2008-2009  Tim Niemueller [www.niemueller.de]
00007  *
00008  ****************************************************************************/
00009 
00010 /*  This program is free software; you can redistribute it and/or modify
00011  *  it under the terms of the GNU General Public License as published by
00012  *  the Free Software Foundation; either version 2 of the License, or
00013  *  (at your option) any later version. A runtime exception applies to
00014  *  this software (see LICENSE.GPL_WRE file mentioned below for details).
00015  *
00016  *  This program is distributed in the hope that it will be useful,
00017  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00018  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00019  *  GNU Library General Public License for more details.
00020  *
00021  *  Read the full text in the LICENSE.GPL_WRE file in the doc directory.
00022  */
00023 
00024 #include <aspect/logger.h>
00025 
00026 namespace fawkes {
00027 
00028 /** @class LoggerAspect <aspect/logger.h>
00029  * Thread aspect that allows to provide a logger to Fawkes.
00030  * The logger will be added to the list of loggers and will get all the
00031  * log messages.
00032  * This aspect can be used for example to attach Fawkes to a custom logging
00033  * facility.
00034  *
00035  * @ingroup Aspects
00036  * @author Tim Niemueller
00037  */
00038 
00039 
00040 /** Constructor.
00041  * @param logger Logger to add to the Fawkes loggers
00042  */
00043 LoggerAspect::LoggerAspect(Logger *logger)
00044 {
00045   __logger = logger;
00046 }
00047 
00048 /** Virtual empty destructor. */
00049 LoggerAspect::~LoggerAspect()
00050 {
00051 }
00052 
00053 
00054 /** Get time source.
00055  * This method is called by the aspect initializer to get the time source
00056  * the thread with this aspect provides.
00057  * @return logger provide by the thread with this aspect
00058  */
00059 Logger *
00060 LoggerAspect::get_logger() const
00061 {
00062   return __logger;
00063 }
00064 
00065 } // end namespace fawkes