Tweak line wrapping for long-keyed, short-values fields.
This commit is contained in:
		| @@ -1,6 +1,6 @@ | ||||
| # Package | ||||
|  | ||||
| version       = "0.2.1" | ||||
| version       = "0.2.2" | ||||
| author        = "Jonathan Bernard" | ||||
| description   = "Small utility to pretty-print strucutured logs." | ||||
| license       = "MIT" | ||||
|   | ||||
| @@ -4,7 +4,7 @@ import docopt, timeutils, zero_functional | ||||
| from std/logging import Level | ||||
| from std/sequtils import toSeq | ||||
|  | ||||
| const VERSION = "0.2.1" | ||||
| const VERSION = "0.2.2" | ||||
|  | ||||
| const USAGE = """Usage: | ||||
|    slfmt [options] | ||||
| @@ -63,7 +63,7 @@ proc fullFormatField(name: string, value: JsonNode): string = | ||||
|       else: strVal = pretty(value) | ||||
|  | ||||
|   let valLines = splitLines(strVal) | ||||
|   if name.len > 10 or strVal.len + 16 > terminalWidth() or valLines.len > 1: | ||||
|   if name.len + strVal.len + 6 > terminalWidth() or valLines.len > 1: | ||||
|     result &= "\n" & valLines.mapIt("  " & it).join("\n") & "\n" | ||||
|   else: result &= strVal & "\n" | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user