Logging tweaks
This commit is contained in:
parent
83d77f8865
commit
361d3ebbcb
|
@ -20,7 +20,7 @@ proc colorEsc(color: string): string {.gcsafe.} =
|
||||||
proc colorize(text: string, color: string): string {.gcsafe.} =
|
proc colorize(text: string, color: string): string {.gcsafe.} =
|
||||||
return colorEsc(color) & text & colorEsc("reset")
|
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
|
# Simply truncate and return if it fills the entire length
|
||||||
if text.len() > length:
|
if text.len() > length:
|
||||||
return text[0..length-1]
|
return text[0..length-1]
|
||||||
|
@ -39,6 +39,7 @@ proc logFormat(text: string, level: string = "undef"): string {.gcsafe.} =
|
||||||
"Error": "red",
|
"Error": "red",
|
||||||
"Info": "purple",
|
"Info": "purple",
|
||||||
"Warning": "orange",
|
"Warning": "orange",
|
||||||
|
"Web": "blue",
|
||||||
"undef": "cyan"
|
"undef": "cyan"
|
||||||
}.toTable()
|
}.toTable()
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@ import nimja/parser
|
||||||
import formatter
|
import formatter
|
||||||
|
|
||||||
proc renderTemplate(templateName: static[string]): string =
|
proc renderTemplate(templateName: static[string]): string =
|
||||||
logPrint("Served template " & templateName, "Main")
|
logPrint("Served template " & templateName, "Web")
|
||||||
compileTemplateFile(getScriptDir() & "/templates/" & templateName)
|
compileTemplateFile(getScriptDir() & "/templates/" & templateName)
|
||||||
|
|
||||||
proc getIndex*(ctx: Context) {.async.} =
|
proc getIndex*(ctx: Context) {.async.} =
|
||||||
|
|
Loading…
Reference in New Issue