source: pacpusframework/branches/0.1.x/include/Pacpus/kernel/Log.h@ 257

Last change on this file since 257 was 143, checked in by Marek Kurdej, 11 years ago

Update: Logger initialization invoked in DbitePlayer.

  • Property svn:executable set to *
File size: 2.3 KB
Line 
1// %pacpus:license{
2// This file is part of the PACPUS framework distributed under the
3// CECILL-C License, Version 1.0.
4// %pacpus:license}
5/// @file
6/// @author Marek Kurdej <firstname.surname@utc.fr>
7/// @date March, 2012
8/// @version $Id: Log.h 73 2013-01-10 16:56:42Z kurdejma $
9/// @copyright Copyright (c) UTC/CNRS Heudiasyc 2006 - 2013. All rights reserved.
10/// @brief Logging facility.
11///
12/// Detailed description.
13
14#ifndef DEF_PACPUS_LOG_H
15#define DEF_PACPUS_LOG_H
16
17// Includes, pacpus.
18#include <Pacpus/kernel/pacpus.h>
19
20namespace pacpus {
21
22/// Static log facility initializer
23///
24/// Uses Schwarz counter (nifty counter) idiom to initialize the log before
25/// other static objects that could use the log.
26static class PACPUSLIB_API LogConfigurator
27{
28public:
29 LogConfigurator();
30 ~LogConfigurator();
31 static void configureLoggerWithFile(const char * configFilename);
32} logInitializer;
33
34} // namespace pacpus
35
36#if defined(PACPUS_USE_LOG)
37
38#include <boost/log/trivial.hpp>
39#include <iosfwd>
40class QString;
41
42template< typename CharT, typename TraitsT >
43PACPUSLIB_API std::basic_ostream< CharT, TraitsT >& operator<< (std::basic_ostream< CharT, TraitsT >& strm, QString const& s);
44
45#define DECLARE_STATIC_LOGGER(name)
46
47#define LOG(level, message) BOOST_LOG_TRIVIAL(level) << message
48#define LOG_TRACE(message) LOG(trace, message)
49#define LOG_DEBUG(message) LOG(debug, message)
50#define LOG_INFO(message) LOG(info, message)
51#define LOG_WARN(message) LOG(warning, message)
52#define LOG_ERROR(message) LOG(error, message)
53#define LOG_FATAL(message) LOG(fatal, message)
54
55#else
56
57/// @param name Name of the logger, displayed when logging a message.
58#define DECLARE_STATIC_LOGGER(name)
59/// Logs a message at TRACE level using default logger
60#define LOG_TRACE(message)
61/// Logs a message at DEBUG level using default logger
62#define LOG_DEBUG(message)
63/// Logs a message at INFO level using default logger
64#define LOG_INFO(message)
65/// Logs a message at WARN level using default logger
66#define LOG_WARN(message)
67/// Logs a message at ERROR level using default logger
68#define LOG_ERROR(message)
69/// Logs a message at FATAL level using default logger
70#define LOG_FATAL(message)
71
72#endif // PACPUS_USE_LOG
73
74#endif // DEF_PACPUS_LOG_H
Note: See TracBrowser for help on using the repository browser.