log-warper-0.3: Flexible, configurable, monadic and pretty logging

Copyright(c) Serokell 2016
LicenseGPL-3 (see the file LICENSE)
MaintainerSerokell <hi@serokell.io>
Stabilityexperimental
PortabilityPOSIX, GHC
Safe HaskellNone
LanguageHaskell2010

System.Wlog.Wrapper

Description

Logging functionality. This module is wrapper over hslogger, which allows to keep logger name in monadic context.

Synopsis

Documentation

data LoggingFormat Source #

Options determining formatting of messages.

Constructors

LoggingFormat 

Fields

  • lfShowTime :: !Bool

    Show time for non-error messages. Note that error messages always have timestamp.

data Severity Source #

This type specifies which messages to print.

Constructors

Debug 
Info 
Notice 
Warning 
Error 

Instances

Eq Severity Source # 
Read Severity Source # 
Show Severity Source # 
Generic Severity Source # 

Associated Types

type Rep Severity :: * -> * #

Methods

from :: Severity -> Rep Severity x #

to :: Rep Severity x -> Severity #

ToJSON Severity Source # 
FromJSON Severity Source # 
SafeCopy Severity Source # 
type Rep Severity Source # 
type Rep Severity = D1 (MetaData "Severity" "System.Wlog.Severity" "log-warper-0.3-L1Tz1dfrKir6Ns7joTZqt5" False) ((:+:) ((:+:) (C1 (MetaCons "Debug" PrefixI False) U1) (C1 (MetaCons "Info" PrefixI False) U1)) ((:+:) (C1 (MetaCons "Notice" PrefixI False) U1) ((:+:) (C1 (MetaCons "Warning" PrefixI False) U1) (C1 (MetaCons "Error" PrefixI False) U1))))

initLogging :: MonadIO m => Severity -> m () Source #

Version of initLoggingWith without any predefined loggers.

initLoggingWith :: MonadIO m => LoggingFormat -> Severity -> m () Source #

This function initializes global logging system. At high level, it sets severity which will be used by all loggers by default, sets default formatters and sets custom severity for given loggers (if any).

On a lower level it does the following: 1. Removes default handler from root logger, sets two handlers such that: 1.1. All messages are printed to stdout. 1.2. Moreover messages with at least Error severity are printed to stderr. 2. Sets given Severity to root logger, so that it will be used by descendant loggers by default. 3. Applies setSeverity to given loggers. It can be done later using setSeverity directly.

releaseAllHandlers :: MonadIO m => m () Source #

Lifted alias to removeAllHandlers.

setSeverity :: MonadIO m => LoggerName -> Severity -> m () Source #

Set severity for given logger. By default parent's severity is used.

setSeverityMaybe :: MonadIO m => LoggerName -> Maybe Severity -> m () Source #

Set or clear severity.