blob: 572ff0d07d58f48cdd44467282ea157964bf84c4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
|
// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Inkscape::Debug::Logger - debug logging facility
*
* Authors:
* MenTaLguY <mental@rydia.net>
*
* Copyright (C) 2005 MenTaLguY
*
* Released under GNU GPL v2+, 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 <typename EventType, typename... Args>
inline static void start(Args&&... args) {
if (_enabled) {
if (_category_mask[EventType::category()]) {
_start(EventType(std::forward<Args>(args)...));
} else {
_skip();
}
}
}
inline static void finish() {
if (_enabled) {
_finish();
}
}
template <typename EventType, typename... Args>
inline static void write(Args&&... args) {
start<EventType, Args...>(std::forward<Args>(args)...);
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:fileencoding=utf-8:textwidth=99 :
|