diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2016-07-07 16:06:01 +0200 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2016-07-07 17:42:25 +0200 |
commit | 9bcb822963fc96c94dbe7dcc4134dcd2dac454ff (patch) | |
tree | 39a946ff8ae7119edb27342e96b65a9785282706 /sinksh/syntax_modules/sink_trace.cpp | |
parent | 9bf9c5c6b08fd086f40a39f033293ff02d9e7fd5 (diff) | |
download | sink-9bcb822963fc96c94dbe7dcc4134dcd2dac454ff.tar.gz sink-9bcb822963fc96c94dbe7dcc4134dcd2dac454ff.zip |
Prepared sinksh trace
Diffstat (limited to 'sinksh/syntax_modules/sink_trace.cpp')
-rw-r--r-- | sinksh/syntax_modules/sink_trace.cpp | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/sinksh/syntax_modules/sink_trace.cpp b/sinksh/syntax_modules/sink_trace.cpp new file mode 100644 index 0000000..e7b92de --- /dev/null +++ b/sinksh/syntax_modules/sink_trace.cpp | |||
@@ -0,0 +1,72 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2016 Christian Mollekopf <chrigi_1@fastmail.fm> | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License as published by | ||
6 | * the Free Software Foundation; either version 2 of the License, or | ||
7 | * (at your option) any later version. | ||
8 | * | ||
9 | * This program is distributed in the hope that it will be useful, | ||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | * GNU General Public License for more details. | ||
13 | * | ||
14 | * You should have received a copy of the GNU General Public License | ||
15 | * along with this program; if not, write to the | ||
16 | * Free Software Foundation, Inc., | ||
17 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | ||
18 | */ | ||
19 | |||
20 | #include <QDebug> | ||
21 | #include <QObject> // tr() | ||
22 | #include <QTimer> | ||
23 | |||
24 | #include "common/resource.h" | ||
25 | #include "common/storage.h" | ||
26 | #include "common/resourceconfig.h" | ||
27 | #include "common/log.h" | ||
28 | #include "common/storage.h" | ||
29 | #include "common/definitions.h" | ||
30 | |||
31 | #include "sinksh_utils.h" | ||
32 | #include "state.h" | ||
33 | #include "syntaxtree.h" | ||
34 | |||
35 | namespace SinkTrace | ||
36 | { | ||
37 | |||
38 | bool trace(const QStringList &args, State &state) | ||
39 | { | ||
40 | // if (args.isEmpty()) { | ||
41 | // state.printError(QObject::tr("Specifiy a debug area to trace.")); | ||
42 | // return false; | ||
43 | // } | ||
44 | // | ||
45 | // | ||
46 | qDebug() << "Trace arguments: " << args; | ||
47 | Sink::Log::setDebugOutputLevel(Sink::Log::Trace); | ||
48 | // Sink::Log::setDebugOutputFilter(Sink::Log::FilterType::Area, "filter"); | ||
49 | |||
50 | return true; | ||
51 | } | ||
52 | |||
53 | bool traceOff(const QStringList &args, State &state) | ||
54 | { | ||
55 | Sink::Log::setDebugOutputLevel(Sink::Log::Log); | ||
56 | qDebug() << "Turned trace off: " << args; | ||
57 | return true; | ||
58 | } | ||
59 | |||
60 | Syntax::List syntax() | ||
61 | { | ||
62 | Syntax trace("trace", QObject::tr("Control trace debug output."), &SinkTrace::trace, Syntax::NotInteractive); | ||
63 | trace.completer = &SinkshUtils::debugareaCompleter; | ||
64 | |||
65 | trace.children << Syntax("off", QObject::tr("Turns off trace output."), &SinkTrace::traceOff, Syntax::NotInteractive); | ||
66 | |||
67 | return Syntax::List() << trace; | ||
68 | } | ||
69 | |||
70 | REGISTER_SYNTAX(SinkTrace) | ||
71 | |||
72 | } | ||