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