Copyright | (c) 2013-2021 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 | None |
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 () #
A function threaded through various request and serialisation routines 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
Enum LogLevel | |
Eq LogLevel | |
Ord LogLevel | |
Defined in Amazonka.Types | |
Show LogLevel | |
Generic LogLevel | |
ToByteString LogLevel | |
Defined in Amazonka.Types toBS :: LogLevel -> ByteString # | |
FromText LogLevel | |
ToText LogLevel | |
Defined in Amazonka.Types | |
type Rep LogLevel | |
Defined in Amazonka.Types type Rep LogLevel = D1 ('MetaData "LogLevel" "Amazonka.Types" "libZSamazonka-coreZSamazonka-core" '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.