summaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
Diffstat (limited to 'common')
-rw-r--r--common/log.cpp18
-rw-r--r--common/log.h21
2 files changed, 24 insertions, 15 deletions
diff --git a/common/log.cpp b/common/log.cpp
index ee28a3b..d2e5f47 100644
--- a/common/log.cpp
+++ b/common/log.cpp
@@ -142,17 +142,19 @@ Sink::Log::DebugLevel Sink::Log::debugOutputLevel()
142 return debugLevelFromName(qgetenv("SINKDEBUGLEVEL")); 142 return debugLevelFromName(qgetenv("SINKDEBUGLEVEL"));
143} 143}
144 144
145void Sink::Log::setFilter(const QByteArrayList &filter) 145void Sink::Log::setDebugOutputFilter(FilterType type, const QByteArrayList &filter)
146{ 146{
147 qputenv("SINKDEBUGFILTER", filter.join(',')); 147 switch (type) {
148} 148 case ApplicationName:
149 149 qputenv("SINKDEBUGFILTER", filter.join(','));
150void Sink::Log::setAreas(const QByteArrayList &filter) 150 break;
151{ 151 case Area:
152 qputenv("SINKDEBUGAREAS", filter.join(',')); 152 qputenv("SINKDEBUGAREAS", filter.join(','));
153 break;
154 }
153} 155}
154 156
155void Sink::Log::setDebugOutput(const QByteArrayList &output) 157void Sink::Log::setDebugOutputFields(const QByteArrayList &output)
156{ 158{
157 qputenv("SINKDEBUGOUTPUT", output.join(',')); 159 qputenv("SINKDEBUGOUTPUT", output.join(','));
158} 160}
diff --git a/common/log.h b/common/log.h
index 8a6c295..92d6cdd 100644
--- a/common/log.h
+++ b/common/log.h
@@ -24,25 +24,32 @@ DebugLevel SINKCOMMON_EXPORT debugLevelFromName(const QByteArray &name);
24void SINKCOMMON_EXPORT setDebugOutputLevel(DebugLevel); 24void SINKCOMMON_EXPORT setDebugOutputLevel(DebugLevel);
25DebugLevel SINKCOMMON_EXPORT debugOutputLevel(); 25DebugLevel SINKCOMMON_EXPORT debugOutputLevel();
26 26
27/// Set debug areas that should be logged 27enum FilterType {
28void SINKCOMMON_EXPORT setAreas(const QByteArrayList &areas); 28 Area,
29 ApplicationName
30};
29 31
30/** 32/**
31 * Set an application name filter. 33 * Sets a debug output filter.
34 *
35 * Everything that is not matching the filter is ignored.
36 * An empty filter matches everything.
32 * 37 *
33 * Note: In case of resources the identifier is the application name. 38 * Note: In case of resources the application name is the identifier.
34 */ 39 */
35void SINKCOMMON_EXPORT setFilter(const QByteArrayList &filter); 40void SINKCOMMON_EXPORT setDebugOutputFilter(FilterType, const QByteArrayList &filter);
36 41
37/** 42/**
38 * Set an application debug output. 43 * Set the debug output fields.
39 * 44 *
40 * Currently supported are: 45 * Currently supported are:
41 * * Name: Application name used for filter. 46 * * Name: Application name used for filter.
42 * * Function: The function name: 47 * * Function: The function name:
43 * * Location: The source code location. 48 * * Location: The source code location.
49 *
50 * These are additional items to the default ones (level, area, message).
44 */ 51 */
45void SINKCOMMON_EXPORT setDebugOutput(const QByteArrayList &filter); 52void SINKCOMMON_EXPORT setDebugOutputFields(const QByteArrayList &filter);
46 53
47QDebug SINKCOMMON_EXPORT debugStream(DebugLevel debugLevel, int line, const char* file, const char* function, const char* debugArea = 0); 54QDebug SINKCOMMON_EXPORT debugStream(DebugLevel debugLevel, int line, const char* file, const char* function, const char* debugArea = 0);
48 55