From 0683bf198bb716732927ca3ac74eafb784d9cb41 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Wed, 30 Aug 2017 20:56:24 +0200 Subject: [PATCH] Fix recursion problem --- lib/core/libimagrt/src/logger.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lib/core/libimagrt/src/logger.rs b/lib/core/libimagrt/src/logger.rs index ec32b616..a1e4de83 100644 --- a/lib/core/libimagrt/src/logger.rs +++ b/lib/core/libimagrt/src/logger.rs @@ -135,6 +135,18 @@ impl Log for ImagLogger { } fn log(&self, record: &LogRecord) { + if record.location().module_path().starts_with("handlebars") { + // This is a ugly, yet necessary hack. When logging, we use handlebars for templating. + // But as the handlebars library itselfs logs via a normal logging macro ("debug!()"), + // we have a recursion in our chain. + // + // To prevent this recursion, we return here. + // + // (As of handlebars 0.29.0 - please check whether you can update handlebars if you see + // this. Hopefully the next version has a compiletime flag to disable logging) + return; + } + let mut data = BTreeMap::new(); {