summaryrefslogtreecommitdiff
path: root/i/marvin/src/log/log.cc
diff options
context:
space:
mode:
Diffstat (limited to 'i/marvin/src/log/log.cc')
-rw-r--r--i/marvin/src/log/log.cc25
1 files changed, 23 insertions, 2 deletions
diff --git a/i/marvin/src/log/log.cc b/i/marvin/src/log/log.cc
index 5b700a7..ba5faa8 100644
--- a/i/marvin/src/log/log.cc
+++ b/i/marvin/src/log/log.cc
@@ -24,12 +24,33 @@
// }}}
#include "log.hh"
+#include "config/config.hh"
+
+#include <string>
+
std::ostream * Log::ostLog_ = &std::cout;
/// Constructeur.
-Log::Log (const char *module, Level level, const char *instance)
- : module_ (module), instance_ (instance), level_(level)
+Log::Log (const char *module, const char *instance)
+ : module_ (module), instance_ (instance)
{
+ // Get Config
+ Config &config = Config::getInstance ();
+ // Get default level log
+ level_ = toLevel (config.get<std::string>("log.level.default"));
+
+ // Get private level if exist
+ if (module)
+ {
+ try
+ {
+ level_ = toLevel (config.get<std::string>(std::string ("log.level.") + module));
+ }
+ catch (std::exception &)
+ {
+ // Do nothing if it does not exist
+ }
+ }
}
/// Crée un nouveau LogMessage.