Copyright | (c) Serokell 2016 |
---|---|
License | GPL-3 (see the file LICENSE) |
Maintainer | Serokell <hi@serokell.io> |
Stability | experimental |
Portability | POSIX, GHC |
Safe Haskell | None |
Language | Haskell2010 |
Logger configuration.
- type LoggerMap = HashMap Text LoggerTree
- data RotationParameters = RotationParameters {
- rpLogLimit :: !Word64
- rpKeepFiles :: !Word
- fromScratch :: Monoid m => State m a -> m
- isValidRotation :: RotationParameters -> Bool
- data HandlerWrap = HandlerWrap {
- _hwFilePath :: !FilePath
- _hwRounding :: !(Maybe Int)
- hwFilePath :: Lens' HandlerWrap FilePath
- hwRounding :: Lens' HandlerWrap (Maybe Int)
- data LoggerTree = LoggerTree {
- _ltSubloggers :: !LoggerMap
- _ltFiles :: ![HandlerWrap]
- _ltSeverity :: !(Maybe Severity)
- ltFiles :: Lens' LoggerTree [HandlerWrap]
- ltSeverity :: Lens' LoggerTree (Maybe Severity)
- ltSubloggers :: Lens' LoggerTree LoggerMap
- data LoggerConfig = LoggerConfig {}
- lcConsoleOutput :: Lens' LoggerConfig Any
- lcFilePrefix :: Lens' LoggerConfig (Maybe FilePath)
- lcMapper :: Lens' LoggerConfig (Endo LoggerName)
- lcRotation :: Lens' LoggerConfig (Maybe RotationParameters)
- lcShowTime :: Lens' LoggerConfig Any
- lcShowTid :: Lens' LoggerConfig Any
- lcTermSeverity :: Lens' LoggerConfig (Maybe Severity)
- lcTree :: Lens' LoggerConfig LoggerTree
- zoomLogger :: Text -> State LoggerTree () -> State LoggerTree ()
- consoleOutB :: LoggerConfig
- mapperB :: (LoggerName -> LoggerName) -> LoggerConfig
- maybePrefixB :: Maybe FilePath -> LoggerConfig
- prefixB :: FilePath -> LoggerConfig
- productionB :: LoggerConfig
- showTidB :: LoggerConfig
- showTimeB :: LoggerConfig
Documentation
data RotationParameters Source #
Parameters for logging rotation.
RotationParameters | |
|
fromScratch :: Monoid m => State m a -> m Source #
Useful lens combinator to be used for logging initialization.
Usually should be used with zoomLogger
.
isValidRotation :: RotationParameters -> Bool Source #
Checks if logger rotation parameters are valid.
Hierarchical tree of loggers (with lenses)
data HandlerWrap Source #
Wrapper over file handler with additional rounding option.
HandlerWrap | |
|
hwRounding :: Lens' HandlerWrap (Maybe Int) Source #
data LoggerTree Source #
Stores configuration for hierarchical loggers.
LoggerTree | |
|
ltFiles :: Lens' LoggerTree [HandlerWrap] Source #
Global logger configuration
data LoggerConfig Source #
Logger configuration which keeps RotationParameters
and LoggerTree
.
LoggerConfig | |
|
Monoid LoggerConfig Source # | |
ToJSON LoggerConfig Source # | This instances violates |
FromJSON LoggerConfig Source # | |
Lenses
zoomLogger :: Text -> State LoggerTree () -> State LoggerTree () Source #
Zooming into logger name with putting specific key.
Builders for LoggerConfig
consoleOutB :: LoggerConfig Source #
Setup lcConsoleOutput
inside LoggerConfig
.
mapperB :: (LoggerName -> LoggerName) -> LoggerConfig Source #
Setup lcMapper
inside LoggerConfig
.
maybePrefixB :: Maybe FilePath -> LoggerConfig Source #
Setup lcFilePrefix
inside LoggerConfig
to optional prefix.
prefixB :: FilePath -> LoggerConfig Source #
Setup lcFilePrefix
inside LoggerConfig
to specific prefix.
productionB :: LoggerConfig Source #
Adds sensible predefined set of parameters to logger.
showTidB :: LoggerConfig Source #
Setup lcShowTid
to True
inside LoggerConfig
.
showTimeB :: LoggerConfig Source #
Setup lcShowTime
to True
inside LoggerConfig
.