Safe Haskell | None |
---|---|
Language | Haskell2010 |
Small layer on top of fast-logger
which adds log-levels and
timestamp support and not much more.
Synopsis
- data Settings
- defSettings :: Settings
- logLevel :: Settings -> Level
- setLogLevel :: Level -> Settings -> Settings
- logLevelOf :: Text -> Settings -> Maybe Level
- setLogLevelOf :: Text -> Level -> Settings -> Settings
- output :: Settings -> Output
- setOutput :: Output -> Settings -> Settings
- format :: Settings -> Maybe DateFormat
- setFormat :: Maybe DateFormat -> Settings -> Settings
- delimiter :: Settings -> ByteString
- readEnvironment :: Settings -> Bool
- setDelimiter :: ByteString -> Settings -> Settings
- setNetStrings :: Bool -> Settings -> Settings
- setReadEnvironment :: Bool -> Settings -> Settings
- setRendererNetstr :: Settings -> Settings
- setRendererDefault :: Settings -> Settings
- bufSize :: Settings -> Int
- setBufSize :: Int -> Settings -> Settings
- name :: Settings -> Maybe Text
- setName :: Maybe Text -> Settings -> Settings
- setRenderer :: Renderer -> Settings -> Settings
- renderer :: Settings -> Renderer
- data Logger
- data Level
- data Output
- newtype DateFormat = DateFormat {
- display :: UnixTime -> ByteString
- type Renderer = ByteString -> DateFormat -> Level -> [Element] -> Builder
- iso8601UTC :: DateFormat
- new :: MonadIO m => Settings -> m Logger
- create :: MonadIO m => Output -> m Logger
- level :: Logger -> Level
- flush :: MonadIO m => Logger -> m ()
- close :: MonadIO m => Logger -> m ()
- clone :: Maybe Text -> Logger -> Logger
- settings :: Logger -> Settings
- log :: MonadIO m => Logger -> Level -> (Msg -> Msg) -> m ()
- trace :: MonadIO m => Logger -> (Msg -> Msg) -> m ()
- debug :: MonadIO m => Logger -> (Msg -> Msg) -> m ()
- info :: MonadIO m => Logger -> (Msg -> Msg) -> m ()
- warn :: MonadIO m => Logger -> (Msg -> Msg) -> m ()
- err :: MonadIO m => Logger -> (Msg -> Msg) -> m ()
- fatal :: MonadIO m => Logger -> (Msg -> Msg) -> m ()
- module System.Logger.Message
Settings
defSettings :: Settings Source #
Default settings:
logLevel
=Debug
output
=StdOut
format
=iso8601UTC
delimiter
= ", "netstrings
= FalsebufSize
=defaultBufSize
name
= NothingreadEnvironment
= True
setLogLevelOf :: Text -> Level -> Settings -> Settings Source #
Specify a log level for the given named logger. When a logger is
clone
d and given a name, the logLevel
of the cloned logger will be
the provided here.
format :: Settings -> Maybe DateFormat Source #
The time and date format used for the timestamp part of a log line.
delimiter :: Settings -> ByteString Source #
Delimiter string which separates log line parts.
readEnvironment :: Settings -> Bool Source #
setDelimiter :: ByteString -> Settings -> Settings Source #
setNetStrings :: Bool -> Settings -> Settings Source #
Whether to use netstring encoding for log lines.
setRendererNetstr :: Settings -> Settings Source #
Shortcut for calling setRenderer
with renderNetstr
.
setRendererDefault :: Settings -> Settings Source #
Default rendering of log lines.
Uses the value of delimiter
as a separator of fields and '=' between
field names and values.
setRenderer :: Renderer -> Settings -> Settings Source #
Set a custom renderer.
See setRendererDefault
and setRendererNetstr
for two common special cases.
Type definitions
newtype DateFormat Source #
DateFormat | |
|
Instances
IsString DateFormat Source # | |
Defined in System.Logger.Settings fromString :: String -> DateFormat # |
type Renderer = ByteString -> DateFormat -> Level -> [Element] -> Builder Source #
Take a custom separator, date format, log level of the event, and render a list of log fields or messages into a builder.
iso8601UTC :: DateFormat Source #
ISO 8601 date-time format.
Core API
create :: MonadIO m => Output -> m Logger Source #
Invokes new
with default settings and the given output as log sink.
clone :: Maybe Text -> Logger -> Logger Source #
Clone the given logger and optionally give it a name
(use Nothing
to clear).
If logLevelOf
returns a custom Level
for this name
then the cloned logger will use it for its log messages.
Logging
log :: MonadIO m => Logger -> Level -> (Msg -> Msg) -> m () Source #
Logs a message with the given level if greater or equal to the logger's threshold.
trace :: MonadIO m => Logger -> (Msg -> Msg) -> m () Source #
Abbreviation of log
using the corresponding log level.
debug :: MonadIO m => Logger -> (Msg -> Msg) -> m () Source #
Abbreviation of log
using the corresponding log level.
info :: MonadIO m => Logger -> (Msg -> Msg) -> m () Source #
Abbreviation of log
using the corresponding log level.
warn :: MonadIO m => Logger -> (Msg -> Msg) -> m () Source #
Abbreviation of log
using the corresponding log level.
err :: MonadIO m => Logger -> (Msg -> Msg) -> m () Source #
Abbreviation of log
using the corresponding log level.
fatal :: MonadIO m => Logger -> (Msg -> Msg) -> m () Source #
Abbreviation of log
using the corresponding log level.
module System.Logger.Message