Logging tweaks

This commit is contained in:
Quad 2022-04-13 22:34:26 +02:00
parent 83d77f8865
commit 361d3ebbcb
2 changed files with 3 additions and 2 deletions

View File

@ -20,7 +20,7 @@ proc colorEsc(color: string): string {.gcsafe.} =
proc colorize(text: string, color: string): string {.gcsafe.} =
return colorEsc(color) & text & colorEsc("reset")
proc strCenter(text: string, filler: string = "-", length: int = 10): string {.gcsafe.} =
proc strCenter(text: string, filler: string = "-", length: int = 8): string {.gcsafe.} =
# Simply truncate and return if it fills the entire length
if text.len() > length:
return text[0..length-1]
@ -39,6 +39,7 @@ proc logFormat(text: string, level: string = "undef"): string {.gcsafe.} =
"Error": "red",
"Info": "purple",
"Warning": "orange",
"Web": "blue",
"undef": "cyan"
}.toTable()

View File

@ -3,7 +3,7 @@ import nimja/parser
import formatter
proc renderTemplate(templateName: static[string]): string =
logPrint("Served template " & templateName, "Main")
logPrint("Served template " & templateName, "Web")
compileTemplateFile(getScriptDir() & "/templates/" & templateName)
proc getIndex*(ctx: Context) {.async.} =