From 2dde08953a36673d5c16854c4beebb13510bc5bc Mon Sep 17 00:00:00 2001 From: ps Date: Thu, 17 Mar 2011 20:48:44 +0000 Subject: [PATCH] add option to control verboseness of log --- src/Configfile.tmpl | 6 ++++++ src/FileLogger.cpp | 6 +++--- src/Logger.h | 6 +++--- src/UnixLogger.cpp | 11 +++++++---- 4 files changed, 19 insertions(+), 10 deletions(-) diff --git a/src/Configfile.tmpl b/src/Configfile.tmpl index e21045e..1d54719 100644 --- a/src/Configfile.tmpl +++ b/src/Configfile.tmpl @@ -150,6 +150,12 @@ string,submit_stats_username,"anonymous" * password string,submit_stats_password,"anonymous" +* log level: +* 0: log only errors +* 1: log errors and information (default) +* 2: debug (passwords might be written in plaintext with this option, so use with care) +int,log_level,1 + #if LOGGER_CLASS==FileLogger * if you are using the filelogger, which file to log to. string,file_logger_filename,"hermes.log" diff --git a/src/FileLogger.cpp b/src/FileLogger.cpp index 291636a..c244e5f 100644 --- a/src/FileLogger.cpp +++ b/src/FileLogger.cpp @@ -70,12 +70,12 @@ void FileLogger::syncBufferToDisk() void FileLogger::addMessage(string file,int line,int loglevel,string logmessage) { + + if(loglevel>cfg.getLogLevel()) return; + pthread_mutex_lock(&mutex); if(cfg.getLogRotationFrequency()>0&&last_rotation+(cfg.getLogRotationFrequency()*60)