Safe Haskell | None |
---|---|
Language | GHC2021 |
Effectful.Logger.Utils
Synopsis
- newtype Namespace = MkNamespace {
- unNamespace :: Seq Text
- displayNamespace :: Namespace -> Text
- data LogLevel
- data LogFormatter = MkLogFormatter {
- locStrategy :: !LocStrategy
- newline :: !Bool
- threadLabel :: !Bool
- timezone :: !Bool
- defaultLogFormatter :: Loc -> LogFormatter
- data LocStrategy
- = LocPartial !Loc
- | LocStable !Loc
- | LocNone
- formatLog :: forall (es :: [Effect]) msg. (Concurrent :> es, HasCallStack, Time :> es, ToLogStr msg) => Maybe Namespace -> LogFormatter -> LogLevel -> msg -> Eff es LogStr
- logStrToText :: LogStr -> Text
- logStrToBs :: LogStr -> ByteString
Namespace
Logging namespace.
Since: 0.1
Constructors
MkNamespace | |
Fields
|
Instances
NFData Namespace Source # | Since: 0.1 | ||||
Defined in Effectful.Logger.Utils | |||||
Monoid Namespace Source # | Since: 0.1 | ||||
Semigroup Namespace Source # | Since: 0.1 | ||||
IsString Namespace Source # | Since: 0.1 | ||||
Defined in Effectful.Logger.Utils Methods fromString :: String -> Namespace # | |||||
Generic Namespace Source # | |||||
Defined in Effectful.Logger.Utils Associated Types
| |||||
IsList Namespace Source # | Since: 0.1 | ||||
Show Namespace Source # | Since: 0.1 | ||||
Eq Namespace Source # | Since: 0.1 | ||||
(k ~ An_Iso, a ~ Seq Text, b ~ Seq Text) => LabelOptic "unNamespace" k Namespace Namespace a b Source # | Since: 0.1 | ||||
Defined in Effectful.Logger.Utils | |||||
type Rep Namespace Source # | Since: 0.1 | ||||
Defined in Effectful.Logger.Utils | |||||
type Item Namespace Source # | |||||
Defined in Effectful.Logger.Utils |
displayNamespace :: Namespace -> Text Source #
Levels
Since: 0.1
Constructors
LevelTrace | Since: 0.1 |
LevelDebug | Since: 0.1 |
LevelInfo | Since: 0.1 |
LevelWarn | Since: 0.1 |
LevelError | Since: 0.1 |
LevelFatal | Since: 0.1 |
LevelOther Text | Since: 0.1 |
Instances
Formatter
data LogFormatter Source #
Formatter for logs.
Since: 0.1
Constructors
MkLogFormatter | |
Fields
|
Instances
Generic LogFormatter Source # | |||||
Defined in Effectful.Logger.Utils Associated Types
| |||||
Show LogFormatter Source # | Since: 0.1 | ||||
Defined in Effectful.Logger.Utils Methods showsPrec :: Int -> LogFormatter -> ShowS # show :: LogFormatter -> String # showList :: [LogFormatter] -> ShowS # | |||||
Eq LogFormatter Source # | Since: 0.1 | ||||
Defined in Effectful.Logger.Utils | |||||
(k ~ A_Lens, a ~ LocStrategy, b ~ LocStrategy) => LabelOptic "locStrategy" k LogFormatter LogFormatter a b Source # | Since: 0.1 | ||||
Defined in Effectful.Logger.Utils Methods labelOptic :: Optic k NoIx LogFormatter LogFormatter a b Source # | |||||
(k ~ A_Lens, a ~ Bool, b ~ Bool) => LabelOptic "newline" k LogFormatter LogFormatter a b Source # | Since: 0.1 | ||||
Defined in Effectful.Logger.Utils Methods labelOptic :: Optic k NoIx LogFormatter LogFormatter a b Source # | |||||
(k ~ A_Lens, a ~ Bool, b ~ Bool) => LabelOptic "threadLabel" k LogFormatter LogFormatter a b Source # | Since: 0.1 | ||||
Defined in Effectful.Logger.Utils Methods labelOptic :: Optic k NoIx LogFormatter LogFormatter a b Source # | |||||
(k ~ A_Lens, a ~ Bool, b ~ Bool) => LabelOptic "timezone" k LogFormatter LogFormatter a b Source # | Since: 0.1 | ||||
Defined in Effectful.Logger.Utils Methods labelOptic :: Optic k NoIx LogFormatter LogFormatter a b Source # | |||||
type Rep LogFormatter Source # | Since: 0.1 | ||||
Defined in Effectful.Logger.Utils type Rep LogFormatter = D1 ('MetaData "LogFormatter" "Effectful.Logger.Utils" "logger-effectful-0.1-inplace" 'False) (C1 ('MetaCons "MkLogFormatter" 'PrefixI 'True) ((S1 ('MetaSel ('Just "locStrategy") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 LocStrategy) :*: S1 ('MetaSel ('Just "newline") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Bool)) :*: (S1 ('MetaSel ('Just "threadLabel") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Bool) :*: S1 ('MetaSel ('Just "timezone") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Bool)))) |
defaultLogFormatter :: Loc -> LogFormatter Source #
LogFormatter
with:
locStrategy
=LocPartial
locnewline
=True
threadLabel
=False
timezone
=False
Since: 0.1
data LocStrategy Source #
Determines how we log location data.
Since: 0.1
Constructors
LocPartial !Loc | Logs the location with filename, line, col. Since: 0.1 |
LocStable !Loc | Logs the location with filename. Since: 0.1 |
LocNone | No location logging. Since: 0.1 |
Instances
Generic LocStrategy Source # | |||||
Defined in Effectful.Logger.Utils Associated Types
| |||||
Show LocStrategy Source # | Since: 0.1 | ||||
Defined in Effectful.Logger.Utils Methods showsPrec :: Int -> LocStrategy -> ShowS # show :: LocStrategy -> String # showList :: [LocStrategy] -> ShowS # | |||||
Eq LocStrategy Source # | Since: 0.1 | ||||
Defined in Effectful.Logger.Utils | |||||
type Rep LocStrategy Source # | Since: 0.1 | ||||
Defined in Effectful.Logger.Utils type Rep LocStrategy = D1 ('MetaData "LocStrategy" "Effectful.Logger.Utils" "logger-effectful-0.1-inplace" 'False) (C1 ('MetaCons "LocPartial" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Loc)) :+: (C1 ('MetaCons "LocStable" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Loc)) :+: C1 ('MetaCons "LocNone" 'PrefixI 'False) (U1 :: Type -> Type))) |
formatLog :: forall (es :: [Effect]) msg. (Concurrent :> es, HasCallStack, Time :> es, ToLogStr msg) => Maybe Namespace -> LogFormatter -> LogLevel -> msg -> Eff es LogStr Source #
Produces a formatted LogStr
.
Since: 0.1
Misc
logStrToText :: LogStr -> Text Source #
Since: 0.1
logStrToBs :: LogStr -> ByteString Source #
Since: 0.1