From c554023a60721ef22f03af7e46059d6b1d4c2fd9 Mon Sep 17 00:00:00 2001 From: Niklas Fasching Date: Wed, 19 Dec 2018 00:26:57 +0100 Subject: [PATCH] Hide logs behind document.Debug flag --- org/document.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/org/document.go b/org/document.go index a7eb2b6..8158e25 100644 --- a/org/document.go +++ b/org/document.go @@ -19,6 +19,7 @@ type Document struct { BufferSettings map[string]string DefaultSettings map[string]string Error error + Debug bool } type Writer interface { @@ -189,7 +190,9 @@ func (d *Document) parseOne(i int, stop stopFn) (consumed int, node Node) { if consumed != 0 { return consumed, node } - log.Printf("Could not parse token %#v: Falling back to treating it as plain text.", d.tokens[i]) + if d.Debug { + log.Printf("Could not parse token %#v: Falling back to treating it as plain text.", d.tokens[i]) + } m := plainTextRegexp.FindStringSubmatch(d.tokens[i].matches[0]) d.tokens[i] = token{"text", len(m[1]), m[2], m} return d.parseOne(i, stop)