summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2012-04-24 18:01:00 (GMT)
committerRemko Tronçon <git@el-tramo.be>2012-04-24 18:01:00 (GMT)
commit5cf6ef99404a08c0e9d2ed4f6df79375fda11d4a (patch)
treebfd9a95fe77c15c2b076c8f99680d08355245689 /Swiften/Base/Log.h
parent2fb37ba9d088e0027560a7d4b2b0617043569d55 (diff)
downloadswift-contrib-5cf6ef99404a08c0e9d2ed4f6df79375fda11d4a.zip
swift-contrib-5cf6ef99404a08c0e9d2ed4f6df79375fda11d4a.tar.bz2
Statically check the log severity level.
Resolves: #1099
Diffstat (limited to 'Swiften/Base/Log.h')
-rw-r--r--Swiften/Base/Log.h12
1 files changed, 10 insertions, 2 deletions
diff --git a/Swiften/Base/Log.h b/Swiften/Base/Log.h
index 5e13a20..955227f 100644
--- a/Swiften/Base/Log.h
+++ b/Swiften/Base/Log.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010 Remko Tronçon
+ * Copyright (c) 2010-2012 Remko Tronçon
* Licensed under the GNU General Public License v3.
* See Documentation/Licenses/GPLv3.txt for more information.
*/
@@ -10,7 +10,15 @@
namespace Swift {
extern bool logging;
+ namespace LogDetail {
+ // Only here to be able to statically check the correctness of the severity levers
+ namespace Severity {
+ enum {
+ debug, warning, error
+ };
+ }
+ }
}
#define SWIFT_LOG(severity) \
- if (!Swift::logging) {} else std::cerr << "[" << #severity << "] " << __FILE__ << ":" << __LINE__ << " " << __FUNCTION__ << ": "
+ if (!Swift::logging) {} else (void) LogDetail::Severity::severity, std::cerr << "[" << #severity << "] " << __FILE__ << ":" << __LINE__ << " " << __FUNCTION__ << ": "