extended-0.1.0: Extended versions of common modules
Safe HaskellSafe-Inferred
LanguageGHC2021

System.Logger.Extended

Description

Tinylog convenience things.

Synopsis

Documentation

data LogFormat Source #

The log formats supported

Instances

Instances details
FromJSON LogFormat Source # 
Instance details

Defined in System.Logger.Extended

ToJSON LogFormat Source # 
Instance details

Defined in System.Logger.Extended

Generic LogFormat Source # 
Instance details

Defined in System.Logger.Extended

Associated Types

type Rep LogFormat :: Type -> Type #

Show LogFormat Source # 
Instance details

Defined in System.Logger.Extended

Eq LogFormat Source # 
Instance details

Defined in System.Logger.Extended

type Rep LogFormat Source # 
Instance details

Defined in System.Logger.Extended

type Rep LogFormat = D1 ('MetaData "LogFormat" "System.Logger.Extended" "extended-0.1.0-4cEsC3fBuRj3mX06ExESZr" 'False) ((C1 ('MetaCons "JSON" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Plain" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "Netstring" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "StructuredJSON" 'PrefixI 'False) (U1 :: Type -> Type)))

mkLogger :: Level -> Maybe (Last Bool) -> Maybe (Last LogFormat) -> IO Logger Source #

Creates a logger given a log format Also takes an useNetstrings argument which is there because we cannot immediatelly deprecate the old interface. Old configs only provide the useNetstrings argument and not the logFormat argument, and in that case implement the old behaviour of either enabling plain text logging or netstring logging. If both arguments are set, logFormat takes presedence over useNetstrings

FUTUREWORK: Once we get rid of the useNetstrings in our config files, we can remove this function and rename mkLoggerNew to mkLogger

mkLogger' :: IO Logger Source #

Like mkLogger, but uses Log.new which reads in LOG_* env variables.

TODO: DEPRECATED! Use mkLogger instead and get all settings from config files, not from environment!

newtype LoggerT m a Source #

It's a bit odd that we mention MonadClient from the cql-io package here, but it's the easiest way to get things done. Alternatively, we could introduce LoggerT in the gundeck integration tests, which is the only place in the world where it is currently used, but we may need it elsewhere in the future and here it's easier to find.

Constructors

LoggerT 

Fields

Instances

Instances details
MonadIO m => MonadIO (LoggerT m) Source # 
Instance details

Defined in System.Logger.Extended

Methods

liftIO :: IO a -> LoggerT m a #

Applicative m => Applicative (LoggerT m) Source # 
Instance details

Defined in System.Logger.Extended

Methods

pure :: a -> LoggerT m a #

(<*>) :: LoggerT m (a -> b) -> LoggerT m a -> LoggerT m b #

liftA2 :: (a -> b -> c) -> LoggerT m a -> LoggerT m b -> LoggerT m c #

(*>) :: LoggerT m a -> LoggerT m b -> LoggerT m b #

(<*) :: LoggerT m a -> LoggerT m b -> LoggerT m a #

Functor m => Functor (LoggerT m) Source # 
Instance details

Defined in System.Logger.Extended

Methods

fmap :: (a -> b) -> LoggerT m a -> LoggerT m b #

(<$) :: a -> LoggerT m b -> LoggerT m a #

Monad m => Monad (LoggerT m) Source # 
Instance details

Defined in System.Logger.Extended

Methods

(>>=) :: LoggerT m a -> (a -> LoggerT m b) -> LoggerT m b #

(>>) :: LoggerT m a -> LoggerT m b -> LoggerT m b #

return :: a -> LoggerT m a #

MonadClient m => MonadClient (LoggerT m) Source # 
Instance details

Defined in System.Logger.Extended

Methods

liftClient :: Client a -> LoggerT m a #

localState :: (ClientState -> ClientState) -> LoggerT m a -> LoggerT m a #

MonadCatch m => MonadCatch (LoggerT m) Source # 
Instance details

Defined in System.Logger.Extended

Methods

catch :: (HasCallStack, Exception e) => LoggerT m a -> (e -> LoggerT m a) -> LoggerT m a #

MonadMask m => MonadMask (LoggerT m) Source # 
Instance details

Defined in System.Logger.Extended

Methods

mask :: HasCallStack => ((forall a. LoggerT m a -> LoggerT m a) -> LoggerT m b) -> LoggerT m b #

uninterruptibleMask :: HasCallStack => ((forall a. LoggerT m a -> LoggerT m a) -> LoggerT m b) -> LoggerT m b #

generalBracket :: HasCallStack => LoggerT m a -> (a -> ExitCase b -> LoggerT m c) -> (a -> LoggerT m b) -> LoggerT m (b, c) #

MonadThrow m => MonadThrow (LoggerT m) Source # 
Instance details

Defined in System.Logger.Extended

Methods

throwM :: (HasCallStack, Exception e) => e -> LoggerT m a #

MonadIO m => MonadLogger (LoggerT m) Source # 
Instance details

Defined in System.Logger.Extended

Methods

log :: Level -> (Msg -> Msg) -> LoggerT m () Source #

netStringsToLogFormat :: Bool -> LogFormat Source #

Here for backwards-compatibility reasons

structuredJSONRenderer :: Renderer Source #

Displays all the Bytes segments in a list under key msgs and Field segments as key-value pair in a JSON

>>> logElems = [Bytes "W", Bytes "The message", Field "field1" "val1", Field "field2" "val2", Field "field1" "val1.1"]
>>> B.toLazyByteString $ structuredJSONRenderer "," iso8601UTC Info logElems
"{\"msgs\":[\"The message\"],\"field1\":[\"val1\",\"val1.1\"],\"field2\":\"val2\",\"level\":\"Warn\"}"

Orphan instances

FromJSON Level Source # 
Instance details

ToJSON Level Source # 
Instance details

Generic Level Source # 
Instance details

Associated Types

type Rep Level :: Type -> Type #

Methods

from :: Level -> Rep Level x #

to :: Rep Level x -> Level #