Hide logs behind document.Debug flag
This commit is contained in:
parent
42dc70e7ad
commit
c554023a60
1 changed files with 4 additions and 1 deletions
|
@ -19,6 +19,7 @@ type Document struct {
|
||||||
BufferSettings map[string]string
|
BufferSettings map[string]string
|
||||||
DefaultSettings map[string]string
|
DefaultSettings map[string]string
|
||||||
Error error
|
Error error
|
||||||
|
Debug bool
|
||||||
}
|
}
|
||||||
|
|
||||||
type Writer interface {
|
type Writer interface {
|
||||||
|
@ -189,7 +190,9 @@ func (d *Document) parseOne(i int, stop stopFn) (consumed int, node Node) {
|
||||||
if consumed != 0 {
|
if consumed != 0 {
|
||||||
return consumed, node
|
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])
|
m := plainTextRegexp.FindStringSubmatch(d.tokens[i].matches[0])
|
||||||
d.tokens[i] = token{"text", len(m[1]), m[2], m}
|
d.tokens[i] = token{"text", len(m[1]), m[2], m}
|
||||||
return d.parseOne(i, stop)
|
return d.parseOne(i, stop)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue