tinylog-0.14.0: Simplistic logging using fast-logger.

Safe HaskellNone
LanguageHaskell2010

System.Logger

Contents

Description

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

Synopsis

Settings

data Settings #

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

Log level of some named logger.

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

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 #

The time and date format used for the timestamp part of a log line.

delimiter :: Settings -> ByteString #

Delimiter string which separates log line parts.

netstrings :: Settings -> Bool #

Whether to use netstring encoding for log lines.

Type definitions

data Logger #

data Level #

Constructors

Trace 
Debug 
Info 
Warn 
Error 
Fatal 

data Output #

Constructors

StdOut 
StdErr 
Path FilePath 

Instances

newtype DateFormat #

Constructors

DateFormat 

iso8601UTC :: DateFormat #

ISO 8601 date-time format.

Core API

new :: MonadIO m => Settings -> m Logger #

create :: MonadIO m => Output -> m Logger #

Invokes new with default settings and the given output as log sink.

level :: Logger -> Level #

Inspect this logger's threshold.

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

Force buffered bytes to output sink.

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

Closes the logger.

clone :: Maybe Text -> Logger -> Logger #

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 () #

Logs a message with the given level if greater or equal to the logger's threshold.

trace :: MonadIO m => Logger -> (Msg -> Msg) -> m () #

Abbreviation of log using the corresponding log level.

debug :: MonadIO m => Logger -> (Msg -> Msg) -> m () #

Abbreviation of log using the corresponding log level.

info :: MonadIO m => Logger -> (Msg -> Msg) -> m () #

Abbreviation of log using the corresponding log level.

warn :: MonadIO m => Logger -> (Msg -> Msg) -> m () #

Abbreviation of log using the corresponding log level.

err :: MonadIO m => Logger -> (Msg -> Msg) -> m () #

Abbreviation of log using the corresponding log level.

fatal :: MonadIO m => Logger -> (Msg -> Msg) -> m () #

Abbreviation of log using the corresponding log level.