Fawkes API  Fawkes Development Version
logging.cpp
1 
2 /***************************************************************************
3  * logging.cpp - Logging aspect for Fawkes
4  *
5  * Created: Wed Jan 17 14:30:20 2007
6  * Copyright 2006-2010 Tim Niemueller [www.niemueller.de]
7  *
8  ****************************************************************************/
9 
10 /* This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version. A runtime exception applies to
14  * this software (see LICENSE.GPL_WRE file mentioned below for details).
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU Library General Public License for more details.
20  *
21  * Read the full text in the LICENSE.GPL_WRE file in the doc directory.
22  */
23 
24 #include <aspect/logging.h>
25 
26 namespace fawkes {
27 
28 /** @class LoggingAspect <aspect/logging.h>
29  * Thread aspect to log output.
30  * Give this aspect to your thread to gain access to the central log.
31  * When using this thread all output should be done with the logger set
32  * for this aspect. Use it to log debug, informational, warning and error
33  * messages. The logger allows for some control over what is being displayed
34  * and where. It may be simple console logout or a network logger.
35  *
36  * It is guaranteed that if used properly from within plugins that
37  * initLoggingAspect() is called before the thread is started and that
38  * you can access the logger via the logger member.
39  *
40  * @ingroup Aspects
41  * @author Tim Niemueller
42  */
43 
44 /** @var Logger LoggingAspect::logger
45  * This is the Logger member used to access the logger.
46  * The logger will remain valid for the whole lifetime of the
47  * thread.
48  */
49 
50 /** Constructor. */
52 {
53  add_aspect("LoggingAspect");
54 }
55 
56 /** Virtual empty Destructor. */
58 {
59 }
60 
61 /** Set the logger.
62  * It is guaranteed that this is called for a logging thread before
63  * Thread::start() is called (when running regularly inside Fawkes).
64  * @param logger Logger instance to use.
65  */
66 void
68 {
69  this->logger = logger;
70 }
71 
72 } // end namespace fawkes
fawkes::Aspect::add_aspect
void add_aspect(const char *name)
Add an aspect to a thread.
Definition: aspect.cpp:49
fawkes::LoggingAspect::~LoggingAspect
virtual ~LoggingAspect()
Virtual empty Destructor.
Definition: logging.cpp:57
fawkes::LoggingAspect::logger
Logger * logger
This is the Logger member used to access the logger.
Definition: logging.h:41
fawkes::Logger
Interface for logging.
Definition: logger.h:42
fawkes
Fawkes library namespace.
fawkes::LoggingAspect::init_LoggingAspect
void init_LoggingAspect(Logger *logger)
Set the logger.
Definition: logging.cpp:67
fawkes::LoggingAspect::LoggingAspect
LoggingAspect()
Constructor.
Definition: logging.cpp:51