fix: strict build, fix pretty rendering

This commit is contained in:
orion 2023-12-23 20:47:01 -06:00
parent c80536d698
commit 135348af98
Signed by: orion
GPG Key ID: 6D4165AE4C928719
3 changed files with 1344 additions and 10 deletions

1334
spago.lock Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,7 @@
package: package:
build:
strict: true
pedantic_packages: true
dependencies: dependencies:
- aff - aff
- arrays - arrays
@ -30,16 +33,11 @@ package:
- tailrec - tailrec
- transformers - transformers
- unlift - unlift
name: project name: logging
workspace: workspace:
extra_packages: extra_packages:
sync: sync:
dependencies:
- aff
- arrays
- avar
git: https://git.orionkindel.com/orion/purescript-sync.git git: https://git.orionkindel.com/orion/purescript-sync.git
ref: 'fe21a2e' ref: 'fe21a2e'
package_set: package_set:
url: https://raw.githubusercontent.com/purescript/package-sets/psc-0.15.10-20230930/packages.json registry: 47.7.1
hash: sha256-nTsd44o7/hrTdk0c6dh0wyBqhFFDJJIeKdQU6L1zv/A=

View File

@ -12,7 +12,7 @@ import Data.JSDate as Date
import Data.List (List) import Data.List (List)
import Data.List as List import Data.List as List
import Data.Log.Types (Actor(..), Level(..), Log, actor, context, level, message) import Data.Log.Types (Actor(..), Level(..), Log, actor, context, level, message)
import Data.Maybe (Maybe(..), fromMaybe) import Data.Maybe (Maybe(..), maybe)
import Data.Newtype (unwrap) import Data.Newtype (unwrap)
import Effect (Effect) import Effect (Effect)
import Effect.Aff (Aff) import Effect.Aff (Aff)
@ -36,8 +36,10 @@ pretty log =
Info -> "[INFO ]" Info -> "[INFO ]"
Warn -> "[WARN ]" Warn -> "[WARN ]"
Error -> "[ERROR]" Error -> "[ERROR]"
actor' = case actor log of Actor { thread } -> fromMaybe "" thread actor' = case actor log of Actor { thread } -> maybe "" (\s -> "[" <> s <> "]") thread
context' = (\{ path: p, context: cs } -> show p <> " " <> (intercalate " > " cs)) $ Array.NonEmpty.last $ context log context'' {path: p, context: []} = "[" <> p <> "]"
context'' {path: p, context: cs} = "[" <> p <> "](" <> intercalate " > " cs <> ")"
context' = context'' $ Array.NonEmpty.last $ context log
in in
intercalate "" [ level', actor', context', message log ] intercalate "" [ level', actor', context', message log ]