Make logging lazy in the string
Make the logging functions accept a Lazy String so we don't pay formatting costs when we don't need to
This commit is contained in:
parent
2c012c57db
commit
fb2f643efa
2 changed files with 5 additions and 5 deletions
|
@ -20,19 +20,19 @@ namespace Logging
|
|||
-->
|
||||
```idris
|
||||
export
|
||||
info : Has (WriterL "log" String) fs => String -> Eff fs ()
|
||||
info : Has (WriterL "log" String) fs => Lazy String -> Eff fs ()
|
||||
info str =
|
||||
let tag = show . bolden . show . colored Green $ "[INFO]"
|
||||
in tellAt "log" (tag ++ ": " ++ str ++ "\n")
|
||||
|
||||
export
|
||||
debug : Has (WriterL "log" String) fs => String -> Eff fs ()
|
||||
debug : Has (WriterL "log" String) fs => Lazy String -> Eff fs ()
|
||||
debug str =
|
||||
let tag = show . bolden . show . colored BrightWhite $ "[DEBUG]"
|
||||
in tellAt "log" (tag ++ ": " ++ str ++ "\n")
|
||||
|
||||
export
|
||||
warn : Has (WriterL "log" String) fs => String -> Eff fs ()
|
||||
warn : Has (WriterL "log" String) fs => Lazy String -> Eff fs ()
|
||||
warn str =
|
||||
let tag = show . bolden . show . colored Yellow $ "[WARN]"
|
||||
in tellAt "log" (tag ++ ": " ++ str ++ "\n")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue