fastcgi++
3.1alpha
A C++ FastCGI/Web API
|
Go to the documentation of this file.
29 #ifndef FASTCGIPP_LOG_HPP
30 #define FASTCGIPP_LOG_HPP
77 #define INFO_LOG(data) {\
78 if(!::Fastcgipp::Logging::suppress)\
80 std::lock_guard<std::mutex> lock(::Fastcgipp::Logging::mutex);\
81 ::Fastcgipp::Logging::header(::Fastcgipp::Logging::INFO);\
82 *::Fastcgipp::Logging::logstream << data << std::endl;\
91 #define FAIL_LOG(data) {\
92 if(!::Fastcgipp::Logging::suppress)\
94 std::lock_guard<std::mutex> lock(::Fastcgipp::Logging::mutex);\
95 ::Fastcgipp::Logging::header(::Fastcgipp::Logging::FAIL);\
96 *::Fastcgipp::Logging::logstream << data << std::endl;\
97 std::exit(EXIT_FAILURE);\
100 #if FASTCGIPP_LOG_LEVEL > 0
107 #define ERROR_LOG(data) \
109 std::lock_guard<std::mutex> lock(::Fastcgipp::Logging::mutex);\
110 ::Fastcgipp::Logging::header(::Fastcgipp::Logging::ERROR);\
111 *::Fastcgipp::Logging::logstream << data << std::endl;\
114 #define ERROR_LOG(data) {}
117 #if FASTCGIPP_LOG_LEVEL > 1
124 #define WARNING_LOG(data) {\
125 if(!::Fastcgipp::Logging::suppress)\
127 std::lock_guard<std::mutex> lock(::Fastcgipp::Logging::mutex);\
128 ::Fastcgipp::Logging::header(::Fastcgipp::Logging::WARNING);\
129 *::Fastcgipp::Logging::logstream << data << std::endl;\
132 #define WARNING_LOG(data) {}
135 #if FASTCGIPP_LOG_LEVEL > 2
136 #define DEBUG_LOG(data) {\
138 if(!::Fastcgipp::Logging::suppress)\
140 std::lock_guard<std::mutex> lock(::Fastcgipp::Logging::mutex);\
141 ::Fastcgipp::Logging::header(::Fastcgipp::Logging::DEBUG);\
142 *::Fastcgipp::Logging::logstream << data << std::endl;\
145 #define DEBUG_LOG(data) {}
148 #if FASTCGIPP_LOG_LEVEL > 3
149 #define DIAG_LOG(data) {\
151 if(!::Fastcgipp::Logging::suppress)\
153 std::lock_guard<std::mutex> lock(::Fastcgipp::Logging::mutex);\
154 ::Fastcgipp::Logging::header(::Fastcgipp::Logging::DIAG);\
155 *::Fastcgipp::Logging::logstream << data << std::endl;\
158 #define DIAG_LOG(data) {}
std::wstring program
Application name to use in loggin.
std::wstring hostname
Hostname to use in logging.
std::mutex mutex
Thread safe the logging mechanism.
Level
Communicate the log level to the header generator.
bool suppress
Set to true if you want to suppress non-error logs.
Topmost namespace for the fastcgi++ library.
std::wostream * logstream
The actual stream we will be logging to.
void header(Level level)
Send a log header to logstream.