log-warper-1.8.11: 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.LoggerConfig

Contents

Description

Logger configuration.

Synopsis

Documentation

fromScratch :: Monoid m => State m a -> m #

Useful lens combinator to be used for logging initialization. Usually should be used with zoomLogger.

isValidRotation :: RotationParameters -> Bool #

Checks if logger rotation parameters are valid.

Hierarchical tree of loggers (with lenses)

data HandlerWrap #

Wrapper over file handler with additional rounding option.

Constructors

HandlerWrap 

Fields

  • _hwFilePath :: !FilePath

    Path to the file to be handled.

  • _hwRounding :: !(Maybe Int)

    Round timestamps to this power of 10 picoseconds. Just 3 would round to nanoseconds. Just 12 would round to seconds.

data LoggerTree #

Stores configuration for hierarchical loggers.

Global logger configuration

data LoggerConfig #

Logger configuration which keeps RotationParameters and LoggerTree.

Constructors

LoggerConfig 

Fields

Lenses

zoomLogger :: LoggerName -> State LoggerTree () -> State LoggerTree () #

Zooming into logger name with putting specific key.

atLogger :: LoggerName -> Traversal' LoggerConfig LoggerTree #

Lens to help to change some particular logger properties.

For example if you want to use default configurations, but need to change logger's severity to warningPlus you can do it this way:

launchWithConfig
    ( defaultConfig "myLogger"
    & atLogger "myLogger"
    . ltSeverity ?~ warningPlus )
    "myLogger"
    action

Builders for LoggerConfig

customConsoleActionB :: Maybe (Handle -> Text -> IO ()) -> LoggerConfig #

Setup lcConsoleOutput inside LoggerConfig.

maybeLogsDirB :: Maybe FilePath -> LoggerConfig #

Setup lcLogsDirectory inside LoggerConfig to optional prefix.

logsDirB :: FilePath -> LoggerConfig #

Setup lcLogsDirectory inside LoggerConfig to specific prefix.

productionB :: LoggerConfig #

Adds sensible predefined set of parameters to logger.