5 | module Log4Types.Context
7 | import Log4Types.Core
8 | import Log4Types.Message
19 | Context = List (String, LogParamValue)
23 | emptyContext : Context
32 | addField : String -> LogParamValue -> Context -> Context
33 | addField name val ctx = ctx ++ [(name, val)]
37 | addStr : String -> String -> Context -> Context
38 | addStr name val = addField name (StrVal val)
42 | addInt : String -> Integer -> Context -> Context
43 | addInt name val = addField name (IntVal val)
47 | addBool : String -> Bool -> Context -> Context
48 | addBool name val = addField name (BoolVal val)
54 | addNamespace : String -> Context -> Context
55 | addNamespace ns = addField "namespace" (StrVal ns)
63 | withContext : Context -> LogAction m Msg -> LogAction m Msg
64 | withContext ctx = cmap (\msg => { fields $= (ctx ++) } msg)