diff options
Diffstat (limited to 'sinksh/syntax_modules')
-rw-r--r-- | sinksh/syntax_modules/sink_trace.cpp | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/sinksh/syntax_modules/sink_trace.cpp b/sinksh/syntax_modules/sink_trace.cpp index d480254..8bd52a0 100644 --- a/sinksh/syntax_modules/sink_trace.cpp +++ b/sinksh/syntax_modules/sink_trace.cpp | |||
@@ -31,6 +31,7 @@ | |||
31 | #include "sinksh_utils.h" | 31 | #include "sinksh_utils.h" |
32 | #include "state.h" | 32 | #include "state.h" |
33 | #include "syntaxtree.h" | 33 | #include "syntaxtree.h" |
34 | #include "iostream" | ||
34 | 35 | ||
35 | namespace SinkTrace | 36 | namespace SinkTrace |
36 | { | 37 | { |
@@ -38,22 +39,24 @@ namespace SinkTrace | |||
38 | bool traceOff(const QStringList &args, State &state) | 39 | bool traceOff(const QStringList &args, State &state) |
39 | { | 40 | { |
40 | Sink::Log::setDebugOutputLevel(Sink::Log::Log); | 41 | Sink::Log::setDebugOutputLevel(Sink::Log::Log); |
41 | qDebug() << "Turned trace off: " << args; | 42 | std::cout << "Turned trace off." << std::endl; |
42 | return true; | 43 | return true; |
43 | } | 44 | } |
44 | 45 | ||
45 | bool traceOn(const QStringList &args, State &state) | 46 | bool traceOn(const QStringList &args, State &state) |
46 | { | 47 | { |
47 | if (args.isEmpty()) { | ||
48 | state.printError(QObject::tr("Specifiy a debug area to trace: ") + Sink::Log::debugAreas().toList().join(", ")); | ||
49 | return false; | ||
50 | } | ||
51 | Sink::Log::setDebugOutputLevel(Sink::Log::Trace); | 48 | Sink::Log::setDebugOutputLevel(Sink::Log::Trace); |
52 | QByteArrayList filter; | 49 | if (args.isEmpty() || (args.size() == 1 && args.first() == "*")) { |
53 | for (const auto &arg : args) { | 50 | Sink::Log::setDebugOutputFilter(Sink::Log::Area, QByteArrayList()); |
54 | filter << arg.toLatin1(); | 51 | std::cout << "Set trace filter to: *" << std::endl; |
52 | } else { | ||
53 | QByteArrayList filter; | ||
54 | for (const auto &arg : args) { | ||
55 | filter << arg.toLatin1(); | ||
56 | } | ||
57 | Sink::Log::setDebugOutputFilter(Sink::Log::Area, filter); | ||
58 | std::cout << "Set trace filter to: " << filter.join(", ").toStdString() << std::endl; | ||
55 | } | 59 | } |
56 | Sink::Log::setDebugOutputFilter(Sink::Log::Area, filter); | ||
57 | return true; | 60 | return true; |
58 | } | 61 | } |
59 | 62 | ||