Fawkes API
Fawkes Development Version
|
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 #if 0 /* just to make Emacs auto-indent happy */ 00028 } 00029 #endif 00030 00031 /** @class LoggerAspect <aspect/logger.h> 00032 * Thread aspect that allows to provide a logger to Fawkes. 00033 * The logger will be added to the list of loggers and will get all the 00034 * log messages. 00035 * This aspect can be used for example to attach Fawkes to a custom logging 00036 * facility. 00037 * 00038 * @ingroup Aspects 00039 * @author Tim Niemueller 00040 */ 00041 00042 00043 /** Constructor. 00044 * @param logger Logger to add to the Fawkes loggers 00045 */ 00046 LoggerAspect::LoggerAspect(Logger *logger) 00047 { 00048 add_aspect("LoggerAspect"); 00049 __logger = logger; 00050 } 00051 00052 /** Virtual empty destructor. */ 00053 LoggerAspect::~LoggerAspect() 00054 { 00055 } 00056 00057 00058 /** Get time source. 00059 * This method is called by the aspect initializer to get the time source 00060 * the thread with this aspect provides. 00061 * @return logger provide by the thread with this aspect 00062 */ 00063 Logger * 00064 LoggerAspect::get_logger() const 00065 { 00066 return __logger; 00067 } 00068 00069 } // end namespace fawkes