Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- data Message = Text :# [SeriesElem]
- newtype SeriesElem = UnsafeSeriesElem {}
- data LoggedMessage = LoggedMessage {}
- threadContextStore :: Store (KeyMap Value)
- logCS :: MonadLogger m => CallStack -> LogSource -> LogLevel -> Message -> m ()
- data OutputOptions = OutputOptions {
- outputAction :: LogLevel -> ByteString -> IO ()
- outputIncludeThreadId :: Bool
- outputBaseThreadContext :: [Pair]
- defaultLogStrBS :: UTCTime -> KeyMap Value -> Loc -> LogSource -> LogLevel -> LogStr -> ByteString
- defaultLogStrLBS :: UTCTime -> KeyMap Value -> Loc -> LogSource -> LogLevel -> LogStr -> ByteString
- messageEncoding :: Message -> Encoding
- messageSeries :: Message -> Series
- data LogItem = LogItem {}
- logItemEncoding :: LogItem -> Encoding
- pairsEncoding :: [Pair] -> Encoding
- pairsSeries :: [Pair] -> Series
- levelEncoding :: LogLevel -> Encoding
- locEncoding :: Loc -> Encoding
- mkLoggerLoc :: SrcLoc -> Loc
- locFromCS :: CallStack -> Loc
- isDefaultLoc :: Loc -> Bool
- data Key
- data KeyMap v
- emptyKeyMap :: KeyMap v
- keyMapFromList :: [(Key, v)] -> KeyMap v
- keyMapToList :: KeyMap v -> [(Key, v)]
- keyMapInsert :: Key -> v -> KeyMap v -> KeyMap v
- keyMapUnion :: KeyMap v -> KeyMap v -> KeyMap v
Disclaimer
In general, changes to this module will not be reflected in the library's version updates. Direct use of this module should be done with care.
Message
-related
A Message
captures a textual component and a metadata component. The
metadata component is a list of SeriesElem
to support tacking on arbitrary
structured data to a log message.
With the OverloadedStrings
extension enabled, Message
values can be
constructed without metadata fairly conveniently, just as if we were using
Text
directly:
logDebug "Some log message without metadata"
Metadata may be included in a Message
via the :#
constructor:
logDebug
$ "Some log message with metadata":#
[ "bloorp".=
(42 ::Int
) , "bonk".=
("abc" ::Text
) ]
The mnemonic for the :#
constructor is that the #
symbol is sometimes
referred to as a hash, a JSON object can be thought of as a hash map, and
so with :#
(and enough squinting), we are cons
-ing a textual message onto
a JSON object. Yes, this mnemonic isn't well-typed, but hopefully it still
helps!
Since: 0.1.0.0
Text :# [SeriesElem] infixr 5 |
newtype SeriesElem Source #
A single key-value pair, where the value is encoded JSON. This is a more
restricted version of Series
: a SeriesElem
encapsulates exactly one
key-value pair, whereas a Series
encapsulates zero or more key-value pairs.
Values of this type are only created via (.=)
from aeson
.
Instances
KeyValue SeriesElem Source # | |
Defined in Control.Monad.Logger.Aeson.Internal (.=) :: ToJSON v => Key -> v -> SeriesElem # |
data LoggedMessage Source #
This type is the Haskell representation of each JSON log message produced by this library.
While we never interact with this type directly when logging messages with
monad-logger-aeson
, we may wish to use this type if we are
parsing/processing log files generated by this library.
Since: 0.1.0.0
Instances
threadContextStore :: Store (KeyMap Value) Source #
Thread-safe, global Store
that captures the thread context of messages.
Note that there is a bit of somewhat unavoidable name-overloading here: this
binding is called threadContextStore
because it stores the thread context
(i.e. ThreadContext
/MDC
from Java land) for messages. It also just so
happens that the Store
type comes from the context
package, which is a
package providing thread-indexed storage of arbitrary context values. Please
don't hate the player!
Since: 0.1.0.0
data OutputOptions Source #
OutputOptions
is for use with
defaultOutputWith
and enables us to configure
the JSON output produced by this library.
We can get a hold of a value of this type via
defaultOutputOptions
.
Since: 0.1.0.0
OutputOptions | |
|
defaultLogStrBS :: UTCTime -> KeyMap Value -> Loc -> LogSource -> LogLevel -> LogStr -> ByteString Source #
defaultLogStrLBS :: UTCTime -> KeyMap Value -> Loc -> LogSource -> LogLevel -> LogStr -> ByteString Source #
messageEncoding :: Message -> Encoding Source #
messageSeries :: Message -> Series Source #
LogItem
-related
logItemEncoding :: LogItem -> Encoding Source #
Encoding-related
pairsEncoding :: [Pair] -> Encoding Source #
pairsSeries :: [Pair] -> Series Source #
levelEncoding :: LogLevel -> Encoding Source #
locEncoding :: Loc -> Encoding Source #
monad-logger
internals
mkLoggerLoc :: SrcLoc -> Loc Source #
Not exported from 'monad-logger', so copied here.
isDefaultLoc :: Loc -> Bool Source #
Not exported from 'monad-logger', so copied here.
Aeson compat
Instances
Eq Key | |
Data Key | |
Defined in Data.Aeson.Key gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Key -> c Key # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Key # dataTypeOf :: Key -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Key) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Key) # gmapT :: (forall b. Data b => b -> b) -> Key -> Key # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Key -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Key -> r # gmapQ :: (forall d. Data d => d -> u) -> Key -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Key -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Key -> m Key # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Key -> m Key # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Key -> m Key # | |
Ord Key | |
Read Key | |
Show Key | |
IsString Key | |
Defined in Data.Aeson.Key fromString :: String -> Key # | |
Semigroup Key | |
Monoid Key | |
Function Key | Since: aeson-2.0.3.0 |
Arbitrary Key | Since: aeson-2.0.3.0 |
CoArbitrary Key | Since: aeson-2.0.3.0 |
Defined in Data.Aeson.Key coarbitrary :: Key -> Gen b -> Gen b # | |
Hashable Key | |
Defined in Data.Aeson.Key | |
ToJSON Key | |
Defined in Data.Aeson.Types.ToJSON | |
ToJSONKey Key | |
Defined in Data.Aeson.Types.ToJSON | |
FromJSON Key | |
FromJSONKey Key | |
Defined in Data.Aeson.Types.FromJSON | |
NFData Key | |
Defined in Data.Aeson.Key | |
Lift Key | |
FunctorWithIndex Key KeyMap | |
FoldableWithIndex Key KeyMap | |
Defined in Data.Aeson.KeyMap | |
TraversableWithIndex Key KeyMap | |
Defined in Data.Aeson.KeyMap | |
SemialignWithIndex Key KeyMap | |
Defined in Data.Aeson.KeyMap | |
ZipWithIndex Key KeyMap | |
FilterableWithIndex Key KeyMap | |
WitherableWithIndex Key KeyMap | |
FromPairs Value (DList Pair) | |
Defined in Data.Aeson.Types.ToJSON | |
v ~ Value => KeyValuePair v (DList Pair) | |
Defined in Data.Aeson.Types.ToJSON |
A map from JSON key type Key
to v
.
Instances
Functor KeyMap | |
Foldable KeyMap | |
Defined in Data.Aeson.KeyMap fold :: Monoid m => KeyMap m -> m # foldMap :: Monoid m => (a -> m) -> KeyMap a -> m # foldMap' :: Monoid m => (a -> m) -> KeyMap a -> m # foldr :: (a -> b -> b) -> b -> KeyMap a -> b # foldr' :: (a -> b -> b) -> b -> KeyMap a -> b # foldl :: (b -> a -> b) -> b -> KeyMap a -> b # foldl' :: (b -> a -> b) -> b -> KeyMap a -> b # foldr1 :: (a -> a -> a) -> KeyMap a -> a # foldl1 :: (a -> a -> a) -> KeyMap a -> a # elem :: Eq a => a -> KeyMap a -> Bool # maximum :: Ord a => KeyMap a -> a # minimum :: Ord a => KeyMap a -> a # | |
Traversable KeyMap | |
Arbitrary1 KeyMap | Since: aeson-2.0.3.0 |
Defined in Data.Aeson.KeyMap liftArbitrary :: Gen a -> Gen (KeyMap a) # liftShrink :: (a -> [a]) -> KeyMap a -> [KeyMap a] # | |
ToJSON1 KeyMap | |
Defined in Data.Aeson.Types.ToJSON liftToJSON :: (a -> Value) -> ([a] -> Value) -> KeyMap a -> Value # liftToJSONList :: (a -> Value) -> ([a] -> Value) -> [KeyMap a] -> Value # liftToEncoding :: (a -> Encoding) -> ([a] -> Encoding) -> KeyMap a -> Encoding # liftToEncodingList :: (a -> Encoding) -> ([a] -> Encoding) -> [KeyMap a] -> Encoding # | |
FromJSON1 KeyMap | Since: aeson-2.0.1.0 |
Semialign KeyMap | |
Align KeyMap | |
Defined in Data.Aeson.KeyMap | |
Zip KeyMap | |
Filterable KeyMap | |
Witherable KeyMap | |
Defined in Data.Aeson.KeyMap wither :: Applicative f => (a -> f (Maybe b)) -> KeyMap a -> f (KeyMap b) # witherM :: Monad m => (a -> m (Maybe b)) -> KeyMap a -> m (KeyMap b) # filterA :: Applicative f => (a -> f Bool) -> KeyMap a -> f (KeyMap a) # witherMap :: Applicative m => (KeyMap b -> r) -> (a -> m (Maybe b)) -> KeyMap a -> m r # | |
FunctorWithIndex Key KeyMap | |
FoldableWithIndex Key KeyMap | |
Defined in Data.Aeson.KeyMap | |
TraversableWithIndex Key KeyMap | |
Defined in Data.Aeson.KeyMap | |
SemialignWithIndex Key KeyMap | |
Defined in Data.Aeson.KeyMap | |
ZipWithIndex Key KeyMap | |
FilterableWithIndex Key KeyMap | |
WitherableWithIndex Key KeyMap | |
Lift v => Lift (KeyMap v :: Type) | |
IsList (KeyMap v) | Since: aeson-2.0.2.0 |
Eq v => Eq (KeyMap v) | |
Data v => Data (KeyMap v) | |
Defined in Data.Aeson.KeyMap gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> KeyMap v -> c (KeyMap v) # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (KeyMap v) # toConstr :: KeyMap v -> Constr # dataTypeOf :: KeyMap v -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (KeyMap v)) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (KeyMap v)) # gmapT :: (forall b. Data b => b -> b) -> KeyMap v -> KeyMap v # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> KeyMap v -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> KeyMap v -> r # gmapQ :: (forall d. Data d => d -> u) -> KeyMap v -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> KeyMap v -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> KeyMap v -> m (KeyMap v) # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> KeyMap v -> m (KeyMap v) # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> KeyMap v -> m (KeyMap v) # | |
Ord v => Ord (KeyMap v) | |
Defined in Data.Aeson.KeyMap | |
Read v => Read (KeyMap v) | |
Show v => Show (KeyMap v) | |
Semigroup (KeyMap v) | |
Monoid (KeyMap v) | |
Function v => Function (KeyMap v) | Since: aeson-2.0.3.0 |
Arbitrary v => Arbitrary (KeyMap v) | Since: aeson-2.0.3.0 |
CoArbitrary v => CoArbitrary (KeyMap v) | Since: aeson-2.0.3.0 |
Defined in Data.Aeson.KeyMap coarbitrary :: KeyMap v -> Gen b -> Gen b # | |
Hashable v => Hashable (KeyMap v) | |
Defined in Data.Aeson.KeyMap | |
ToJSON v => ToJSON (KeyMap v) | |
Defined in Data.Aeson.Types.ToJSON | |
value ~ Value => KeyValue (KeyMap value) | Constructs a singleton |
FromJSON v => FromJSON (KeyMap v) | Since: aeson-2.0.1.0 |
NFData v => NFData (KeyMap v) | |
Defined in Data.Aeson.KeyMap | |
type Item (KeyMap v) | |
Defined in Data.Aeson.KeyMap |
emptyKeyMap :: KeyMap v Source #
keyMapFromList :: [(Key, v)] -> KeyMap v Source #
keyMapToList :: KeyMap v -> [(Key, v)] Source #