Fawkes API Fawkes Development Version
logger.cpp
1
2/***************************************************************************
3 * logger.cpp - Logger aspect for Fawkes
4 *
5 * Created: Wed Feb 11 22:21:56 2009
6 * Copyright 2008-2009 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/logger.h>
25
26namespace fawkes {
27
28/** @class LoggerAspect <aspect/logger.h>
29 * Thread aspect that allows to provide a logger to Fawkes.
30 * The logger will be added to the list of loggers and will get all the
31 * log messages.
32 * This aspect can be used for example to attach Fawkes to a custom logging
33 * facility.
34 *
35 * @ingroup Aspects
36 * @author Tim Niemueller
37 */
38
39/** Constructor.
40 * @param logger Logger to add to the Fawkes loggers
41 */
43{
44 add_aspect("LoggerAspect");
45 logger_ = logger;
46}
47
48/** Virtual empty destructor. */
50{
51}
52
53/** Get time source.
54 * This method is called by the aspect initializer to get the time source
55 * the thread with this aspect provides.
56 * @return logger provide by the thread with this aspect
57 */
58Logger *
60{
61 return logger_;
62}
63
64} // end namespace fawkes
void add_aspect(const char *name)
Add an aspect to a thread.
Definition: aspect.cpp:49
Logger * get_logger() const
Get time source.
Definition: logger.cpp:59
virtual ~LoggerAspect()
Virtual empty destructor.
Definition: logger.cpp:49
LoggerAspect(Logger *logger) __attribute__((nonnull))
Constructor.
Definition: logger.cpp:42
Interface for logging.
Definition: logger.h:42
Fawkes library namespace.