Fawkes API Fawkes Development Version
|
00001 00002 /*************************************************************************** 00003 * logging.h - Logging aspect for Fawkes 00004 * 00005 * Created: Wed Jan 17 14:30:20 2007 00006 * Copyright 2006-2007 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/logging.h> 00025 00026 namespace fawkes { 00027 00028 /** @class LoggingAspect <aspect/logging.h> 00029 * Thread aspect to log output. 00030 * Give this aspect to your thread to gain access to the central log. 00031 * When using this thread all output should be done with the logger set 00032 * for this aspect. Use it to log debug, informational, warning and error 00033 * messages. The logger allows for some control over what is being displayed 00034 * and where. It may be simple console logout or a network logger. 00035 * 00036 * It is guaranteed that if used properly from within plugins that 00037 * initLoggingAspect() is called before the thread is started and that 00038 * you can access the logger via the logger member. 00039 * 00040 * @ingroup Aspects 00041 * @author Tim Niemueller 00042 */ 00043 00044 00045 /** @var Logger LoggingAspect::logger 00046 * This is the Logger member used to access the logger. 00047 * The logger will remain valid for the whole lifetime of the 00048 * thread. 00049 */ 00050 00051 /** Virtual empty Destructor. */ 00052 LoggingAspect::~LoggingAspect() 00053 { 00054 } 00055 00056 00057 /** Set the logger. 00058 * It is guaranteed that this is called for a logging thread before 00059 * Thread::start() is called (when running regularly inside Fawkes). 00060 * @param logger Logger instance to use. 00061 */ 00062 void 00063 LoggingAspect::init_LoggingAspect(Logger *logger) 00064 { 00065 this->logger = logger; 00066 } 00067 00068 } // end namespace fawkes