From 5d97522d18da39cd3f9dd309774a5ad2c51f4c51 Mon Sep 17 00:00:00 2001 From: Matt Holt Date: Tue, 25 Feb 2020 22:00:33 -0700 Subject: v2: 'log' directive for Caddyfile, and debug mode (#3052) * httpcaddyfile: Begin implementing log directive, and debug mode For now, debug mode just sets the log level for all logs to DEBUG (unless a level is specified explicitly). * httpcaddyfile: Finish 'log' directive Also rename StringEncoder -> SingleFieldEncoder * Fix minor bug in replacer (when vals are empty) --- replacer.go | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'replacer.go') diff --git a/replacer.go b/replacer.go index 8ed6d24..aad13e2 100644 --- a/replacer.go +++ b/replacer.go @@ -148,11 +148,10 @@ func (r *Replacer) replace(input, empty string, if errOnUnknown { return "", fmt.Errorf("unrecognized placeholder %s%s%s", string(phOpen), key, string(phClose)) - } else if treatUnknownAsEmpty { - if empty != "" { - sb.WriteString(empty) - } - } else { + } else if !treatUnknownAsEmpty { + // if treatUnknownAsEmpty is true, we'll + // handle an empty val later; so only + // continue otherwise lastWriteCursor = i continue } -- cgit v1.2.3