Copyright | (c) 2013-2023 Brendan Hay |
---|---|
License | Mozilla Public License, v. 2.0. |
Maintainer | Brendan Hay <brendan.g.hay+amazonka@gmail.com> |
Stability | provisional |
Portability | non-portable (GHC extensions) |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Types and functions for constructing loggers and emitting log messages.
Synopsis
- type Logger = LogLevel -> ByteStringBuilder -> IO ()
- newLogger :: MonadIO m => LogLevel -> Handle -> m Logger
- data LogLevel
- logError :: (MonadIO m, ToLog a) => Logger -> a -> m ()
- logInfo :: (MonadIO m, ToLog a) => Logger -> a -> m ()
- logDebug :: (MonadIO m, ToLog a) => Logger -> a -> m ()
- logTrace :: (MonadIO m, ToLog a) => Logger -> a -> m ()
- class ToLog a where
- build :: a -> ByteStringBuilder
- buildLines :: [ByteStringBuilder] -> ByteStringBuilder
Constructing a Logger
type Logger = LogLevel -> ByteStringBuilder -> IO () Source #
A logging function called by various default hooks to log informational and debug messages.
newLogger :: MonadIO m => LogLevel -> Handle -> m Logger Source #
This is a primitive logger which can be used to log builds to a Handle
.
Note: A more sophisticated logging library such as tinylog or fast-logger should be used in production code.
Levels
Info | Info messages supplied by the user - this level is not emitted by the library. |
Error | Error messages only. |
Debug | Useful debug information + info + error levels. |
Trace | Includes potentially sensitive signing metadata, and non-streaming response bodies. |
Instances
ToByteString LogLevel Source # | |
Defined in Amazonka.Logger toBS :: LogLevel -> ByteString # | |
FromText LogLevel Source # | |
ToText LogLevel Source # | |
Defined in Amazonka.Logger | |
Enum LogLevel Source # | |
Generic LogLevel Source # | |
Show LogLevel Source # | |
Eq LogLevel Source # | |
Ord LogLevel Source # | |
Defined in Amazonka.Logger | |
type Rep LogLevel Source # | |
Defined in Amazonka.Logger type Rep LogLevel = D1 ('MetaData "LogLevel" "Amazonka.Logger" "amazonka-2.0-48plDWnPMAk3PGO79vdSa0" 'False) ((C1 ('MetaCons "Info" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Error" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "Debug" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Trace" 'PrefixI 'False) (U1 :: Type -> Type))) |
Building Messages
build :: a -> ByteStringBuilder #
Convert a value to a loggable builder.
Instances
buildLines :: [ByteStringBuilder] -> ByteStringBuilder #
Intercalate a list of ByteStringBuilder
s with newlines.