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 #if 0 /* just to make Emacs auto-indent happy */
28 }
29 #endif
30 
31 /** @class LoggingAspect <aspect/logging.h>
32  * Thread aspect to log output.
33  * Give this aspect to your thread to gain access to the central log.
34  * When using this thread all output should be done with the logger set
35  * for this aspect. Use it to log debug, informational, warning and error
36  * messages. The logger allows for some control over what is being displayed
37  * and where. It may be simple console logout or a network logger.
38  *
39  * It is guaranteed that if used properly from within plugins that
40  * initLoggingAspect() is called before the thread is started and that
41  * you can access the logger via the logger member.
42  *
43  * @ingroup Aspects
44  * @author Tim Niemueller
45  */
46 
47 
48 /** @var Logger LoggingAspect::logger
49  * This is the Logger member used to access the logger.
50  * The logger will remain valid for the whole lifetime of the
51  * thread.
52  */
53 
54 /** Constructor. */
56 {
57  add_aspect("LoggingAspect");
58 }
59 
60 
61 /** Virtual empty Destructor. */
63 {
64 }
65 
66 
67 /** Set the logger.
68  * It is guaranteed that this is called for a logging thread before
69  * Thread::start() is called (when running regularly inside Fawkes).
70  * @param logger Logger instance to use.
71  */
72 void
74 {
75  this->logger = logger;
76 }
77 
78 } // end namespace fawkes
Fawkes library namespace.
virtual ~LoggingAspect()
Virtual empty Destructor.
Definition: logging.cpp:62
Logger * logger
This is the Logger member used to access the logger.
Definition: logging.h:44
void add_aspect(const char *name)
Add an aspect to a thread.
Definition: aspect.cpp:52
void init_LoggingAspect(Logger *logger)
Set the logger.
Definition: logging.cpp:73
LoggingAspect()
Constructor.
Definition: logging.cpp:55
Interface for logging.
Definition: logger.h:34