Copyright | Copyright 2022 Shea Levy. |
---|---|
License | Apache-2.0 |
Maintainer | shea@shealevy.com |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Observe.Event.Render.JSON.Handle
Contents
Description
Synopsis
- jsonHandleBackend :: Exception stex => Handle -> RenderExJSON stex -> RenderSelectorJSON s -> IO (EventBackend IO JSONRef s)
- simpleJsonStderrBackend :: RenderSelectorJSON s -> IO (EventBackend IO JSONRef s)
- newtype JSONRef = JSONRef UUID
- newJSONEvent :: Exception stex => (Object -> IO ()) -> RenderExJSON stex -> RenderFieldJSON f -> Maybe JSONRef -> [JSONRef] -> [f] -> IO (Event IO JSONRef f)
Documentation
Arguments
:: Exception stex | |
=> Handle | Where to write |
-> RenderExJSON stex | Render a structured exception to JSON |
-> RenderSelectorJSON s | Render a selector, and the fields of |
-> IO (EventBackend IO JSONRef s) |
An EventBackend
which posts events to a given Handle
as JSON.
Each Event
is posted as a single line, as it's completed. As a result, child events
will typically be posted before their parents (though still possible to correlate via
event IDs).
The EventBackend
must be the exclusive writer to the Handle
while any events are live,
but it does not hClose
it itself.
simpleJsonStderrBackend :: RenderSelectorJSON s -> IO (EventBackend IO JSONRef s) Source #
An EventBackend
which posts events to stderr
as JSON.
Each Event
is posted as a single line, as it's completed. As a result, child events
will typically be posted before their parents (though still possible to correlate via
event IDs).
Any instrumented Exception
s descended from SomeJSONException
will be structurally rendered.
The EventBackend
must be the exclusive writer to stderr
while any events are live,
but it does not hClose
it itself.
Internals
The reference type for EventBackend
s generated by jsonHandleBackend
.
Only expected to be used by type inference or by code implementing other backends using this one.
Arguments
:: Exception stex | |
=> (Object -> IO ()) | Emit the final |
-> RenderExJSON stex | |
-> RenderFieldJSON f | |
-> Maybe JSONRef | Parent |
-> [JSONRef] | Causes |
-> [f] | Initial fields |
-> IO (Event IO JSONRef f) |
Create a new Event
in a jsonHandleBackend
.