log-warper-1.4.0: 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 Severity Source #

Severity is level of log message importance. It uniquely determines which messages to print.

Constructors

Debug

Debug messages

Info

Information

Notice

Important (more than average) information

Warning

General warnings

Error

General errors/severe errors

Instances

Bounded Severity Source # 
Enum Severity Source # 
Eq Severity Source # 
Ord 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 #

FromJSON Severity Source # 
ToJSON Severity Source # 
SafeCopy Severity Source # 
type Rep Severity Source # 
type Rep Severity = D1 (MetaData "Severity" "System.Wlog.Severity" "log-warper-1.4.0-wgf6ZwaBQoAnLh9nUpCPB" 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))))

initTerminalLogging Source #

Arguments

:: MonadIO m 
=> (UTCTime -> Text) 
-> (Handle -> Text -> IO ()) 
-> Bool

Show time?

-> Bool

Show ThreadId?

-> Maybe Severity 
-> m () 

This function initializes global logging system for terminal output. 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).

NOTE: you probably don't want to use this function. Consider setupLogging.

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.