24#ifndef quantlib_tracing_hpp
25#define quantlib_tracing_hpp
30#include <boost/current_function.hpp>
43 #if defined(QL_ENABLE_TRACING)
46 QL_FAIL(
"tracing support not available");
218#if defined(QL_ENABLE_TRACING)
220#define QL_DEFAULT_TRACER QuantLib::detail::Tracing::instance()
222#define QL_TRACE_ENABLE \
223QL_DEFAULT_TRACER.enable()
225#define QL_TRACE_DISABLE \
226QL_DEFAULT_TRACER.disable()
228#define QL_TRACE_ON(out) \
229QL_DEFAULT_TRACER.setStream(out)
231#define QL_TRACE(message) \
232if (QL_DEFAULT_TRACER.enabled()) \
234 QL_DEFAULT_TRACER.stream() << "trace[" << QL_DEFAULT_TRACER.depth() \
235 << "]: " << message << std::endl; \
239#define QL_TRACE_ENTER_FUNCTION \
240if (QL_DEFAULT_TRACER.enabled()) \
242 QL_DEFAULT_TRACER.down(); \
243 QL_DEFAULT_TRACER.stream() << "trace[" << QL_DEFAULT_TRACER.depth() \
245 << "Entering " << BOOST_CURRENT_FUNCTION \
250#define QL_TRACE_EXIT_FUNCTION \
251if (QL_DEFAULT_TRACER.enabled()) \
253 QL_DEFAULT_TRACER.stream() << "trace[" << QL_DEFAULT_TRACER.depth() \
255 << "Exiting " << BOOST_CURRENT_FUNCTION \
257 QL_DEFAULT_TRACER.up(); \
258 } catch (...) { QL_DEFAULT_TRACER.up(); } \
261#define QL_TRACE_LOCATION \
262QL_TRACE("At line " << __LINE__ << " in " << __FILE__)
264#define QL_TRACE_VARIABLE(variable) \
265QL_TRACE(#variable << " = " << variable)
269#define QL_DEFAULT_TRACER
270#define QL_TRACE_ENABLE
271#define QL_TRACE_DISABLE
272#define QL_TRACE_ON(out)
273#define QL_TRACE(message)
274#define QL_TRACE_ENTER_FUNCTION
275#define QL_TRACE_EXIT_FUNCTION
276#define QL_TRACE_LOCATION
277#define QL_TRACE_VARIABLE(variable)
Basic support for the singleton pattern.
void setStream(std::ostream &stream)
Classes and functions for error handling.
#define QL_FAIL(message)
throw an error (possibly with file and line information)
QL_INTEGER Integer
integer number
basic support for the singleton pattern