From 179fa413b047bede6e32109e2ce82437c5fb8d34 Mon Sep 17 00:00:00 2001 From: MenTaLguY Date: Mon, 16 Jan 2006 02:36:01 +0000 Subject: moving trunk for module inkscape (bzr r1) --- src/debug/logger.h | 171 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 171 insertions(+) create mode 100644 src/debug/logger.h (limited to 'src/debug/logger.h') diff --git a/src/debug/logger.h b/src/debug/logger.h new file mode 100644 index 000000000..61f9c2764 --- /dev/null +++ b/src/debug/logger.h @@ -0,0 +1,171 @@ +/* + * Inkscape::Debug::Logger - debug logging facility + * + * Authors: + * MenTaLguY + * + * Copyright (C) 2005 MenTaLguY + * + * Released under GNU GPL, read the file 'COPYING' for more information + */ + +#ifndef SEEN_INKSCAPE_DEBUG_LOGGER_H +#define SEEN_INKSCAPE_DEBUG_LOGGER_H + +#include "debug/event.h" + +namespace Inkscape { + +namespace Debug { + +class Logger { +public: + static void init(); + + template + inline static void start() { + if (_enabled) { + if (_category_mask[EventType::category()]) { + _start(EventType()); + } else { + _skip(); + } + } + } + + template + inline static void start(A const &a) { + if (_enabled) { + if (_category_mask[EventType::category()]) { + _start(EventType(a)); + } else { + _skip(); + } + } + } + + template + inline static void start(A const &a, B const &b) { + if (_enabled) { + if (_category_mask[EventType::category()]) { + _start(EventType(a, b)); + } else { + _skip(); + } + } + } + + template + inline static void start(A const &a, B const &b, C const &c) { + if (_enabled) { + if (_category_mask[EventType::category()]) { + _start(EventType(a, b, c)); + } else { + _skip(); + } + } + } + + template + inline static void start(A const &a, B const &b, C const &c, D const &d) { + if (_enabled) { + if (_category_mask[EventType::category()]) { + _start(EventType(a, b, c, d)); + } else { + _skip(); + } + } + } + + template + inline static void start(A const &a, B const &b, C const &c, + D const &d, E const &e) + { + if (_enabled) { + if (_category_mask[EventType::category()]) { + _start(EventType(a, b, c, d, e)); + } else { + _skip(); + } + } + } + + template + inline static void start(A const &a, B const &b, C const &c, + D const &d, E const &e, F const &f) + { + if (_enabled) { + if (_category_mask[EventType::category()]) { + _start(EventType(a, b, c, d, e, f)); + } else { + _skip(); + } + } + } + + template + inline static void start(A const &a, B const &b, C const &c, D const &d, + E const &e, F const &f, G const &g) + { + if (_enabled) { + if (_category_mask[EventType::category()]) { + _start(EventType(a, b, c, d, e, f, g)); + } else { + _skip(); + } + } + } + + template + inline static void start(A const &a, B const &b, C const &c, D const &d, + E const &e, F const &f, G const &g, H const &h) + { + if (_enabled) { + if (_category_mask[EventType::category()]) { + _start(EventType(a, b, c, d, e, f, g, h)); + } else { + _skip(); + } + } + } + + inline static void finish() { + if (_enabled) { + _finish(); + } + } + + static void shutdown(); + +private: + static bool _enabled; + + static void _start(Event const &event); + static void _skip(); + static void _finish(); + + static bool _category_mask[Event::N_CATEGORIES]; +}; + +} + +} + +#endif +/* + Local Variables: + mode:c++ + c-file-style:"stroustrup" + c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +)) + indent-tabs-mode:nil + fill-column:99 + End: +*/ +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : -- cgit v1.2.3