tinylog-0.15.0: Simplistic logging using fast-logger.
Safe HaskellSafe-Inferred
LanguageHaskell2010

System.Logger

Description

Small layer on top of fast-logger which adds log-levels and timestamp support and not much more.

Synopsis

Settings

logLevelOf :: Text -> Settings -> Maybe Level Source #

Log level of some named logger.

setLogLevelOf :: Text -> Level -> Settings -> Settings Source #

Specify a log level for the given named logger. When a logger is cloned 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.

setNetStrings :: Bool -> Settings -> Settings Source #

Whether to use netstring encoding for log lines.

{#- DEPRECATED setNetStrings "Use setRendererNetstr or setRendererDefault instead" #-}

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.

renderer :: Settings -> Renderer Source #

Output format

Type definitions

data Level Source #

Constructors

Trace 
Debug 
Info 
Warn 
Error 
Fatal 

Instances

Instances details
Read Level Source # 
Instance details

Defined in System.Logger.Settings

Show Level Source # 
Instance details

Defined in System.Logger.Settings

Methods

showsPrec :: Int -> Level -> ShowS #

show :: Level -> String #

showList :: [Level] -> ShowS #

Eq Level Source # 
Instance details

Defined in System.Logger.Settings

Methods

(==) :: Level -> Level -> Bool #

(/=) :: Level -> Level -> Bool #

Ord Level Source # 
Instance details

Defined in System.Logger.Settings

Methods

compare :: Level -> Level -> Ordering #

(<) :: Level -> Level -> Bool #

(<=) :: Level -> Level -> Bool #

(>) :: Level -> Level -> Bool #

(>=) :: Level -> Level -> Bool #

max :: Level -> Level -> Level #

min :: Level -> Level -> Level #

data Output Source #

Constructors

StdOut 
StdErr 
Path FilePath 

Instances

Instances details
Show Output Source # 
Instance details

Defined in System.Logger.Settings

Eq Output Source # 
Instance details

Defined in System.Logger.Settings

Methods

(==) :: Output -> Output -> Bool #

(/=) :: Output -> Output -> Bool #

Ord Output Source # 
Instance details

Defined in System.Logger.Settings

newtype DateFormat Source #

Constructors

DateFormat 

Instances

Instances details
IsString DateFormat Source # 
Instance details

Defined in System.Logger.Settings

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.

level :: Logger -> Level Source #

Inspect this logger's threshold.

flush :: MonadIO m => Logger -> m () Source #

Force buffered bytes to output sink.

close :: MonadIO m => Logger -> m () Source #

Closes the logger.

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.