aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar Hoa V. DINH <dinh.viet.hoa@gmail.com>2013-04-08 21:40:47 -0700
committerGravatar Hoa V. DINH <dinh.viet.hoa@gmail.com>2013-04-08 21:40:47 -0700
commitc8bc94b4640bd2d370af69b446d3edd0c97264de (patch)
tree5a501376139a84ea85fb1be34fd35aac41e74fc9 /src
parent76603c42b60325c888ff2bcea649eeed9ce1a720 (diff)
log only if logEnabled if set to true
Diffstat (limited to 'src')
-rw-r--r--src/core/basetypes/MCLog.cc4
-rw-r--r--src/core/basetypes/MCLog.h2
2 files changed, 6 insertions, 0 deletions
diff --git a/src/core/basetypes/MCLog.cc b/src/core/basetypes/MCLog.cc
index 060ceaa0..7db01b41 100644
--- a/src/core/basetypes/MCLog.cc
+++ b/src/core/basetypes/MCLog.cc
@@ -9,6 +9,7 @@
#include <unistd.h>
static pid_t sPid = -1;
+bool mailcore::logEnabled = false;
__attribute__((constructor))
static void initialize() {
@@ -36,6 +37,9 @@ static void logInternalv(FILE * file,
const char * user, const char * filename, unsigned int line,
int dumpStack, const char * format, va_list argp)
{
+ if (!mailcore::logEnabled)
+ return;
+
while (1) {
const char * p = filename;
diff --git a/src/core/basetypes/MCLog.h b/src/core/basetypes/MCLog.h
index 78f8cac8..b84a2182 100644
--- a/src/core/basetypes/MCLog.h
+++ b/src/core/basetypes/MCLog.h
@@ -10,6 +10,8 @@
namespace mailcore {
+ extern bool logEnabled;
+
#ifndef __printflike
#define __printflike(a,b)
#endif