-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | Flexible, configurable, monadic and pretty logging
--   
--   This package implements nice and featureful wrapper around hslogger
--   library.
@package log-warper
@version 1.8.11


-- | Some helpers and utilites to work with files
module System.Wlog.FileUtils

-- | Performs given action on file if file exists.
whenExist :: MonadIO m => FilePath -> (FilePath -> m ()) -> m ()


-- | Contains <tt>newtype</tt> wrapper around logger name to support
--   hierarchy.
module System.Wlog.LoggerName

-- | Logger name to keep in context.
newtype LoggerName
LoggerName :: Text -> LoggerName
[getLoggerName] :: LoggerName -> Text
instance GHC.Generics.Generic System.Wlog.LoggerName.LoggerName
instance Data.Hashable.Class.Hashable System.Wlog.LoggerName.LoggerName
instance GHC.Classes.Ord System.Wlog.LoggerName.LoggerName
instance GHC.Classes.Eq System.Wlog.LoggerName.LoggerName
instance Data.String.IsString System.Wlog.LoggerName.LoggerName
instance GHC.Show.Show System.Wlog.LoggerName.LoggerName
instance Data.Semigroup.Semigroup System.Wlog.LoggerName.LoggerName
instance GHC.Base.Monoid System.Wlog.LoggerName.LoggerName
instance Data.Text.Buildable.Buildable System.Wlog.LoggerName.LoggerName
instance Data.Aeson.Types.ToJSON.ToJSON System.Wlog.LoggerName.LoggerName
instance Data.Aeson.Types.ToJSON.ToJSONKey System.Wlog.LoggerName.LoggerName


-- | This module contains type class for <a>HasLoggerName</a>.
module System.Wlog.HasLoggerName

-- | This type class exists to remove boilerplate logging by adding the
--   logger's name to the context in each module.
--   
--   TODO: replace current methods with Lens?
class HasLoggerName m

-- | Extract logger name from context
askLoggerName :: HasLoggerName m => m LoggerName

-- | Change logger name in context
modifyLoggerName :: HasLoggerName m => (LoggerName -> LoggerName) -> m a -> m a

-- | Extract logger name from context
askLoggerName :: (HasLoggerName m, MonadTrans t, t n ~ m, Monad n, HasLoggerName n) => m LoggerName

-- | Change logger name in context
modifyLoggerName :: (HasLoggerName m, MFunctor t, t n ~ m, Monad n, HasLoggerName n) => (LoggerName -> LoggerName) -> m a -> m a

-- | Set logger name in context.
setLoggerName :: HasLoggerName m => LoggerName -> m a -> m a

-- | Change logger name to the given one
withSublogger :: HasLoggerName m => LoggerName -> m a -> m a
instance (GHC.Base.Monad m, System.Wlog.HasLoggerName.HasLoggerName m) => System.Wlog.HasLoggerName.HasLoggerName (Control.Monad.Trans.Reader.ReaderT a m)
instance (GHC.Base.Monad m, System.Wlog.HasLoggerName.HasLoggerName m) => System.Wlog.HasLoggerName.HasLoggerName (Control.Monad.Trans.State.Strict.StateT a m)
instance (GHC.Base.Monad m, System.Wlog.HasLoggerName.HasLoggerName m) => System.Wlog.HasLoggerName.HasLoggerName (Control.Monad.Trans.State.Lazy.StateT a m)
instance (GHC.Base.Monoid w, GHC.Base.Monad m, System.Wlog.HasLoggerName.HasLoggerName m) => System.Wlog.HasLoggerName.HasLoggerName (Control.Monad.Trans.Writer.Lazy.WriterT w m)
instance (GHC.Base.Monad m, System.Wlog.HasLoggerName.HasLoggerName m) => System.Wlog.HasLoggerName.HasLoggerName (Control.Monad.Trans.Except.ExceptT e m)
instance (GHC.Base.Monad m, System.Wlog.HasLoggerName.HasLoggerName m) => System.Wlog.HasLoggerName.HasLoggerName (Control.Monad.Trans.Cont.ContT r m)
instance (GHC.Base.Monad m, System.Wlog.HasLoggerName.HasLoggerName m, GHC.Base.Monoid w) => System.Wlog.HasLoggerName.HasLoggerName (Control.Monad.Trans.RWS.Lazy.RWST r w s m)
instance (GHC.Base.Monad m, System.Wlog.HasLoggerName.HasLoggerName m, GHC.Base.Monoid w) => System.Wlog.HasLoggerName.HasLoggerName (Control.Monad.Trans.RWS.Strict.RWST r w s m)
instance System.Wlog.HasLoggerName.HasLoggerName Data.Functor.Identity.Identity


-- | This module contains type classes for loggers that have
--   <a>LoggerName</a>.
module System.Wlog.LoggerNameBox

-- | Default implementation of <tt>WithNamedLogger</tt>.
newtype LoggerNameBox m a
LoggerNameBox :: ReaderT LoggerName m a -> LoggerNameBox m a
[loggerNameBoxEntry] :: LoggerNameBox m a -> ReaderT LoggerName m a

-- | Runs a <a>LoggerNameBox</a> with specified initial <a>LoggerName</a>.
usingLoggerName :: LoggerName -> LoggerNameBox m a -> m a
instance Control.Monad.Fix.MonadFix m => Control.Monad.Fix.MonadFix (System.Wlog.LoggerNameBox.LoggerNameBox m)
instance Control.Monad.State.Class.MonadState s m => Control.Monad.State.Class.MonadState s (System.Wlog.LoggerNameBox.LoggerNameBox m)
instance Control.Monad.Error.Class.MonadError e m => Control.Monad.Error.Class.MonadError e (System.Wlog.LoggerNameBox.LoggerNameBox m)
instance Control.Monad.Catch.MonadMask m => Control.Monad.Catch.MonadMask (System.Wlog.LoggerNameBox.LoggerNameBox m)
instance Control.Monad.Catch.MonadCatch m => Control.Monad.Catch.MonadCatch (System.Wlog.LoggerNameBox.LoggerNameBox m)
instance Control.Monad.Catch.MonadThrow m => Control.Monad.Catch.MonadThrow (System.Wlog.LoggerNameBox.LoggerNameBox m)
instance Control.Monad.Base.MonadBase b m => Control.Monad.Base.MonadBase b (System.Wlog.LoggerNameBox.LoggerNameBox m)
instance Control.Monad.Trans.Class.MonadTrans System.Wlog.LoggerNameBox.LoggerNameBox
instance Control.Monad.IO.Class.MonadIO m => Control.Monad.IO.Class.MonadIO (System.Wlog.LoggerNameBox.LoggerNameBox m)
instance GHC.Base.Monad m => GHC.Base.Monad (System.Wlog.LoggerNameBox.LoggerNameBox m)
instance GHC.Base.Applicative m => GHC.Base.Applicative (System.Wlog.LoggerNameBox.LoggerNameBox m)
instance GHC.Base.Functor m => GHC.Base.Functor (System.Wlog.LoggerNameBox.LoggerNameBox m)
instance Control.Monad.Reader.Class.MonadReader r m => Control.Monad.Reader.Class.MonadReader r (System.Wlog.LoggerNameBox.LoggerNameBox m)
instance Control.Monad.Trans.Control.MonadBaseControl b m => Control.Monad.Trans.Control.MonadBaseControl b (System.Wlog.LoggerNameBox.LoggerNameBox m)
instance Control.Monad.Morph.MFunctor System.Wlog.LoggerNameBox.LoggerNameBox
instance GHC.Base.Monad m => System.Wlog.HasLoggerName.HasLoggerName (System.Wlog.LoggerNameBox.LoggerNameBox m)


-- | Custom wrapper around <tt>hslogger.Priority</tt>.
module System.Wlog.Severity

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

-- | Debug messages
Debug :: Severity

-- | Information
Info :: Severity

-- | Important (more than average) information
Notice :: Severity

-- | General warnings
Warning :: Severity

-- | General errors/severe errors
Error :: Severity

-- | Set of <a>Severity</a>.
type Severities = Set Severity

-- | Internal type of log records.
data LogRecord
LR :: !Severity -> !Text -> LogRecord

-- | <a>Set</a> of all <a>Severity</a>s.
allSeverities :: Set Severity

-- | Returns the <a>Set</a> of <a>Severity</a>s of elements greater or
--   equal to the given value.
severityPlus :: Severity -> Set Severity

-- | Returns <a>Set</a> of <a>Severity</a>s not less than <a>Debug</a>.
debugPlus :: Set Severity

-- | Returns <a>Set</a> of <a>Severity</a>s not less than <a>Info</a>.
infoPlus :: Set Severity

-- | Returns <a>Set</a> of <a>Severity</a>s not less than <a>Notice</a>.
noticePlus :: Set Severity

-- | Returns <a>Set</a> of <a>Severity</a>s not less than <a>Warning</a>.
warningPlus :: Set Severity

-- | Returns <a>Set</a> of <a>Severity</a>s not less than <a>Error</a>.
errorPlus :: Set Severity

-- | Excludes <a>Error</a> from the <a>Set</a> of <a>Severity</a>s.
excludeError :: Set Severity -> Set Severity
instance GHC.Show.Show System.Wlog.Severity.LogRecord
instance GHC.Generics.Generic System.Wlog.Severity.Severity
instance GHC.Read.Read System.Wlog.Severity.Severity
instance GHC.Show.Show System.Wlog.Severity.Severity
instance GHC.Enum.Bounded System.Wlog.Severity.Severity
instance GHC.Enum.Enum System.Wlog.Severity.Severity
instance GHC.Classes.Ord System.Wlog.Severity.Severity
instance GHC.Classes.Eq System.Wlog.Severity.Severity
instance Data.Aeson.Types.FromJSON.FromJSON System.Wlog.Severity.Severity
instance Data.Aeson.Types.ToJSON.ToJSON System.Wlog.Severity.Severity


-- | Pretty looking formatters for logger.
--   
--   Please see <a>System.WLog.Logger</a> for extensive documentation on
--   the logging system.
module System.Wlog.Formatter
stdoutFormatter :: (UTCTime -> Text) -> Bool -> Bool -> LogFormatter a
stdoutFormatterTimeRounded :: (UTCTime -> Text) -> Int -> LogFormatter a

-- | Formats UTC time in next format: "%Y-%m-%d %H:%M:%S%Q %Z" but %Q part
--   show only in centiseconds (always 2 digits).
centiUtcTimeF :: UTCTime -> Text

-- | Get the current time rounded to 10^n picoseconds. n = 3 rounds to the
--   nearest nanosecond. n = 6 rounds to the nearest microsecond. n = 9
--   will round to the nearest millisecond. n = 12 will round to the
--   nearest second.
getRoundedTime :: Int -> IO UTCTime

-- | A LogFormatter is used to format log messages. Note that it is
--   paramterized on the <tt>Handler</tt> to allow the formatter to use
--   information specific to the handler (an example of can be seen in the
--   formatter used in <a>Syslog</a>)
type LogFormatter a = a  The LogHandler that the passed message came from -> LogRecord  The log message and priority -> Text  The logger name -> IO Builder  The formatted log message

-- | Returns the passed message as is, ie. no formatting is done.
nullFormatter :: LogFormatter a

-- | Takes a format string, and returns a formatter that may be used to
--   format log messages. The format string may contain variables prefixed
--   with a $-sign which will be replaced at runtime with corresponding
--   values. The currently supported variables are:
--   
--   <ul>
--   <li><tt>$msg</tt> - The actual log message</li>
--   <li><tt>$loggername</tt> - The name of the logger</li>
--   <li><tt>$prio</tt> - The priority level of the message</li>
--   <li><tt>$tid</tt> - The thread ID</li>
--   <li><tt>$pid</tt> - Process ID (Not available on windows)</li>
--   <li><tt>$time</tt> - The current time</li>
--   <li><tt>$utcTime</tt> - The current time in UTC Time</li>
--   </ul>
simpleLogFormatter :: Text -> LogFormatter a

-- | Like <a>simpleLogFormatter</a> but allow the time format to be
--   specified in the first parameter (this is passed to <a>formatTime</a>)
tfLogFormatter :: Text -> Text -> LogFormatter a

-- | An extensible formatter that allows new substition <i>variables</i> to
--   be defined. Each variable has an associated IO action that is used to
--   produce the string to substitute for the variable name. The predefined
--   variables are the same as for <a>simpleLogFormatter</a>
--   <i>excluding</i> <tt>$time</tt> and <tt>$utcTime</tt>.
varFormatter :: [(Text, Text)] -> Text -> LogFormatter a


-- | Definition of log handler support
--   
--   For some handlers, check out <a>System.WLog.Handler.Simple</a> and
--   <a>System.WLog.Handler.Syslog</a>.
--   
--   Please see <a>System.WLog.Logger</a> for extensive documentation on
--   the logging system.
--   
--   Written by John Goerzen, jgoerzen@complete.org
module System.Wlog.LogHandler

-- | Tag identifying handlers.
data LogHandlerTag
HandlerFilelike :: FilePath -> LogHandlerTag
HandlerOther :: String -> LogHandlerTag

-- | This is the base class for the various log handlers. They should all
--   adhere to this class.
class LogHandler a

-- | Tag of handler. Is arbitrary. Made for identification.
getTag :: LogHandler a => a -> LogHandlerTag

-- | Sets the log level. <tt>handle</tt> will drop items beneath this
--   level.
setLevel :: LogHandler a => a -> Severities -> a

-- | Gets the current level.
getLevel :: LogHandler a => a -> Severities

-- | Set a log formatter to customize the log format for this Handler
setFormatter :: LogHandler a => a -> LogFormatter a -> a
getFormatter :: LogHandler a => a -> LogFormatter a

-- | Forces an event to be logged regardless of the configured level.
emit :: (LogHandler a, MonadIO m) => a -> Builder -> Text -> m ()

-- | Read back from logger (e.g. file), newest first. You specify the
--   number of (newest) logging entries. Logger can return <tt>pure []</tt>
--   if this behaviour can't be emulated or store buffer.
readBack :: (LogHandler a, MonadIO m) => a -> Int -> m [Text]

-- | Closes the logging system, causing it to close any open files, etc.
close :: (LogHandler a, MonadIO m) => a -> m ()

-- | Logs an event if it meets the requirements given by the most recent
--   call to <a>setLevel</a>.
logHandlerMessage :: (MonadIO m, LogHandler a) => a -> LogRecord -> LoggerName -> m ()
instance GHC.Classes.Eq System.Wlog.LogHandler.LogHandlerTag
instance GHC.Show.Show System.Wlog.LogHandler.LogHandlerTag


-- | Simple log handlers
--   
--   Written by John Goerzen, jgoerzen@complete.org
module System.Wlog.LogHandler.Simple

-- | A helper data type.
data GenericHandler a
GenericHandler :: !Severities -> !(LogFormatter (GenericHandler a)) -> !a -> !(a -> Text -> IO ()) -> !(a -> IO ()) -> !(MVar (MemoryQueue Text)) -> !LogHandlerTag -> GenericHandler a
[severities] :: GenericHandler a -> !Severities
[formatter] :: GenericHandler a -> !(LogFormatter (GenericHandler a))
[privData] :: GenericHandler a -> !a
[writeFunc] :: GenericHandler a -> !(a -> Text -> IO ())
[closeFunc] :: GenericHandler a -> !(a -> IO ())
[readBackBuffer] :: GenericHandler a -> !(MVar (MemoryQueue Text))
[ghTag] :: GenericHandler a -> !LogHandlerTag

-- | Default action which just prints to handle using given message.
defaultHandleAction :: Handle -> Text -> IO ()

-- | Create a file log handler. Log messages sent to this handler will be
--   sent to the filename specified, which will be opened in Append mode.
--   Calling <a>close</a> on the handler will close the file.
fileHandler :: FilePath -> Severities -> IO (GenericHandler Handle)

-- | Create a stream log handler. Log messages sent to this handler will be
--   sent to the stream used initially. Note that the <a>close</a> method
--   will have no effect on stream handlers; it does not actually close the
--   underlying stream.
streamHandler :: Handle -> (Handle -> Text -> IO ()) -> MVar () -> Severities -> IO (GenericHandler Handle)
instance Data.Typeable.Internal.Typeable a => System.Wlog.LogHandler.LogHandler (System.Wlog.LogHandler.Simple.GenericHandler a)


-- | Logger configuration.
module System.Wlog.LoggerConfig
type LoggerMap = HashMap LoggerName LoggerTree

-- | Parameters for logging rotation.
data RotationParameters
RotationParameters :: !Word64 -> !Word -> RotationParameters

-- | max size of file in bytes
[rpLogLimit] :: RotationParameters -> !Word64

-- | number of files to keep
[rpKeepFiles] :: RotationParameters -> !Word

-- | Useful lens combinator to be used for logging initialization. Usually
--   should be used with <a>zoomLogger</a>.
fromScratch :: Monoid m => State m a -> m

-- | Checks if logger rotation parameters are valid.
isValidRotation :: RotationParameters -> Bool

-- | Wrapper over file handler with additional rounding option.
data HandlerWrap
HandlerWrap :: !FilePath -> !(Maybe Int) -> HandlerWrap

-- | Path to the file to be handled.
[_hwFilePath] :: HandlerWrap -> !FilePath

-- | Round timestamps to this power of 10 picoseconds. Just 3 would round
--   to nanoseconds. Just 12 would round to seconds.
[_hwRounding] :: HandlerWrap -> !(Maybe Int)
hwFilePath :: Lens' HandlerWrap FilePath
hwRounding :: Lens' HandlerWrap (Maybe Int)

-- | Stores configuration for hierarchical loggers.
data LoggerTree
LoggerTree :: !LoggerMap -> ![HandlerWrap] -> !(Maybe Severities) -> LoggerTree
[_ltSubloggers] :: LoggerTree -> !LoggerMap
[_ltFiles] :: LoggerTree -> ![HandlerWrap]
[_ltSeverity] :: LoggerTree -> !(Maybe Severities)
ltFiles :: Lens' LoggerTree [HandlerWrap]
ltSeverity :: Lens' LoggerTree (Maybe Severities)
ltSubloggers :: Lens' LoggerTree LoggerMap

-- | Logger configuration which keeps <a>RotationParameters</a> and
--   <a>LoggerTree</a>.
data LoggerConfig
LoggerConfig :: Maybe RotationParameters -> Maybe Severities -> Maybe Severities -> Any -> Any -> Last (Handle -> Text -> IO ()) -> Endo LoggerName -> Maybe FilePath -> LoggerTree -> LoggerConfig

-- | Rotation parameters for logger config. See <a>Roller</a>.
[_lcRotation] :: LoggerConfig -> Maybe RotationParameters

-- | Severity for terminal <a>stdout</a> output. If <tt>Nothing</tt> along
--   with <a>_lcTermSeverityErr</a> then <tt>Warning</tt> and greater
--   excluding <tt>Error</tt> are used.
[_lcTermSeverityOut] :: LoggerConfig -> Maybe Severities

-- | Severity for terminal <a>stderr</a> output. If <tt>Nothing</tt> along
--   with <a>_lcTermSeverityOut</a> then <tt>Error</tt> is used.
[_lcTermSeverityErr] :: LoggerConfig -> Maybe Severities

-- | Show time for non-error messages. Note that error messages always have
--   timestamp.
[_lcShowTime] :: LoggerConfig -> Any

-- | Show <tt>ThreadId</tt> for current logging thread.
[_lcShowTid] :: LoggerConfig -> Any

-- | Specifies action for printing to console.
[_lcConsoleAction] :: LoggerConfig -> Last (Handle -> Text -> IO ())

-- | Defines how to transform logger names in config.
[_lcMapper] :: LoggerConfig -> Endo LoggerName

-- | Specifies directory for log files. This can be useful to avoid
--   prefixes if you have a lot of loggers. Another use case: different
--   logger directories on different platforms.
[_lcLogsDirectory] :: LoggerConfig -> Maybe FilePath

-- | Hierarchical tree of loggers.
[_lcTree] :: LoggerConfig -> LoggerTree
lcConsoleAction :: Lens' LoggerConfig (Last (Handle -> Text -> IO ()))
lcLogsDirectory :: Lens' LoggerConfig (Maybe FilePath)
lcMapper :: Lens' LoggerConfig (Endo LoggerName)
lcRotation :: Lens' LoggerConfig (Maybe RotationParameters)
lcShowTime :: Lens' LoggerConfig Any
lcShowTid :: Lens' LoggerConfig Any
lcTermSeverityOut :: Lens' LoggerConfig (Maybe Severities)
lcTermSeverityErr :: Lens' LoggerConfig (Maybe Severities)
lcTree :: Lens' LoggerConfig LoggerTree

-- | Zooming into logger name with putting specific key.
zoomLogger :: LoggerName -> State LoggerTree () -> State 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 <a>warningPlus</a> you can do it this way:
--   
--   <pre>
--   <a>launchWithConfig</a>
--       ( defaultConfig "myLogger"
--       &amp; <a>atLogger</a> "myLogger"
--       . <a>ltSeverity</a> ?~ <a>warningPlus</a> )
--       "myLogger"
--       action
--   </pre>
atLogger :: LoggerName -> Traversal' LoggerConfig LoggerTree
consoleActionB :: (Handle -> Text -> IO ()) -> LoggerConfig

-- | Setup <tt>lcConsoleOutput</tt> inside <a>LoggerConfig</a>.
customConsoleActionB :: Maybe (Handle -> Text -> IO ()) -> LoggerConfig

-- | Setup <a>lcMapper</a> inside <a>LoggerConfig</a>.
mapperB :: (LoggerName -> LoggerName) -> LoggerConfig

-- | Setup <a>lcLogsDirectory</a> inside <a>LoggerConfig</a> to optional
--   prefix.
maybeLogsDirB :: Maybe FilePath -> LoggerConfig

-- | Setup <a>lcLogsDirectory</a> inside <a>LoggerConfig</a> to specific
--   prefix.
logsDirB :: FilePath -> LoggerConfig

-- | Adds sensible predefined set of parameters to logger.
productionB :: LoggerConfig

-- | Setup <a>lcShowTid</a> to <a>True</a> inside <a>LoggerConfig</a>.
showTidB :: LoggerConfig

-- | Setup <a>lcShowTime</a> to <a>True</a> inside <a>LoggerConfig</a>.
showTimeB :: LoggerConfig

-- | Setup <a>lcTermSeverityOut</a> to specified severity inside
--   <a>LoggerConfig</a>.
termSeveritiesOutB :: Severities -> LoggerConfig

-- | Setup <a>lcTermSeverityErr</a> to specified severity inside
--   <a>LoggerConfig</a>.
termSeveritiesErrB :: Severities -> LoggerConfig
instance GHC.Exception.Exception System.Wlog.LoggerConfig.LoggerLensException
instance GHC.Show.Show System.Wlog.LoggerConfig.LoggerLensException
instance Data.Semigroup.Semigroup System.Wlog.LoggerConfig.LoggerConfig
instance GHC.Base.Monoid System.Wlog.LoggerConfig.LoggerConfig
instance Data.Aeson.Types.FromJSON.FromJSON System.Wlog.LoggerConfig.LoggerConfig
instance Data.Aeson.Types.ToJSON.ToJSON System.Wlog.LoggerConfig.LoggerConfig
instance GHC.Show.Show System.Wlog.LoggerConfig.RotationParameters
instance GHC.Generics.Generic System.Wlog.LoggerConfig.RotationParameters
instance Data.Text.Buildable.Buildable System.Wlog.LoggerConfig.RotationParameters
instance Data.Aeson.Types.ToJSON.ToJSON System.Wlog.LoggerConfig.RotationParameters
instance Data.Aeson.Types.FromJSON.FromJSON System.Wlog.LoggerConfig.RotationParameters
instance Data.Semigroup.Semigroup System.Wlog.LoggerConfig.LoggerTree
instance GHC.Base.Monoid System.Wlog.LoggerConfig.LoggerTree
instance Data.Aeson.Types.ToJSON.ToJSON System.Wlog.LoggerConfig.HandlerWrap
instance Data.Aeson.Types.FromJSON.FromJSON System.Wlog.LoggerConfig.HandlerWrap
instance Data.Aeson.Types.ToJSON.ToJSON System.Wlog.LoggerConfig.LoggerTree
instance Data.Aeson.Types.FromJSON.FromJSON System.Wlog.LoggerConfig.LoggerTree
instance GHC.Show.Show System.Wlog.LoggerConfig.LoggerTree
instance GHC.Generics.Generic System.Wlog.LoggerConfig.LoggerTree
instance GHC.Show.Show System.Wlog.LoggerConfig.HandlerWrap
instance GHC.Generics.Generic System.Wlog.LoggerConfig.HandlerWrap


-- | Custom implementation of <a>LogHandler</a> with log rotation support.
module System.Wlog.LogHandler.Roller
newtype InvalidRotation
InvalidRotation :: Text -> InvalidRotation

-- | Similar to <a>GenericHandler</a>. But holds file <a>Handle</a> inside
--   mutable variable (<a>MVar</a>) to be able to rotate loggers.
data RollerHandler
RollerHandler :: !Severities -> !(LogFormatter RollerHandler) -> !(MVar Handle) -> !(Handle -> Text -> IO ()) -> !(Handle -> IO ()) -> !FilePath -> RollerHandler
[rhSeverities] :: RollerHandler -> !Severities
[rhFormatter] :: RollerHandler -> !(LogFormatter RollerHandler)
[rhFileHandle] :: RollerHandler -> !(MVar Handle)
[rhWriteAction] :: RollerHandler -> !(Handle -> Text -> IO ())
[rhCloseAction] :: RollerHandler -> !(Handle -> IO ())
[rhFileName] :: RollerHandler -> !FilePath
logIndex :: FilePath -> Int -> FilePath

-- | Create rotation logging handler.
rotationFileHandler :: MonadIO m => RotationParameters -> FilePath -> Severities -> m RollerHandler
instance GHC.Classes.Eq System.Wlog.LogHandler.Roller.InvalidRotation
instance GHC.Show.Show System.Wlog.LogHandler.Roller.InvalidRotation
instance GHC.Exception.Exception System.Wlog.LogHandler.Roller.InvalidRotation
instance System.Wlog.LogHandler.LogHandler System.Wlog.LogHandler.Roller.RollerHandler


-- | Haskell Logging Framework, Primary Interface
--   
--   Written by John Goerzen, jgoerzen@complete.org
--   
--   This module is a modification of <a>System.Log.Logger</a> of
--   <tt>hslogger</tt> library. Unless proper description is written here,
--   please use the original documentation available on hackage/hslogger.
module System.Wlog.IOLogger
data Logger

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

-- | Debug messages
Debug :: Severity

-- | Information
Info :: Severity

-- | Important (more than average) information
Notice :: Severity

-- | General warnings
Warning :: Severity

-- | General errors/severe errors
Error :: Severity

-- | Log a message using the given logger at a given priority.
logM :: MonadIO m => LoggerName -> Severity -> Text -> m ()
logMCond :: MonadIO m => LoggerName -> Severity -> Text -> (LogHandlerTag -> Bool) -> m ()

-- | Allow graceful shutdown. Release all opened files<i>handlers</i>etc.
removeAllHandlers :: MonadIO m => m ()

-- | Returns the logger for the given name. If no logger with that name
--   exists, creates new loggers and any necessary parent loggers, with no
--   connected handlers.
getLogger :: MonadIO m => LoggerName -> m Logger

-- | Returns the root logger.
getRootLogger :: MonadIO m => m Logger

-- | The name of the root logger, which is always defined and present on
--   the system.
rootLoggerName :: LoggerName

-- | Add handler to <a>Logger</a>. Returns a new <a>Logger</a>.
addHandler :: LogHandler a => a -> Logger -> Logger

-- | Remove a handler from the <a>Logger</a>. Handlers are removed in the
--   reverse order they were added, so the following property holds for any
--   <a>LogHandler</a> <tt>h</tt>:
--   
--   <pre>
--   removeHandler . addHandler h = id
--   </pre>
--   
--   If no handlers are associated with the <a>Logger</a>, it is returned
--   unchanged.
--   
--   The root logger's default handler that writes every message to stderr
--   can be removed by using this function before any handlers have been
--   added to the root logger:
--   
--   <pre>
--   updateGlobalLogger rootLoggerName removeHandler
--   </pre>
removeHandler :: Logger -> Logger

-- | Set the 'Logger'\'s list of handlers to the list supplied. All
--   existing handlers are removed first.
setHandlers :: LogHandler a => [a] -> Logger -> Logger

-- | Returns the "level" of the logger. Items beneath this level will be
--   ignored.
getLevel :: Logger -> Maybe Severities

-- | Sets the "level" of the <a>Logger</a>. Returns a new <a>Logger</a>
--   object with the new level.
setLevel :: Severities -> Logger -> Logger

-- | Clears the "level" of the <a>Logger</a>. It will now inherit the level
--   of | its parent.
clearLevel :: Logger -> Logger

-- | Set severities for given logger. By default parent's severities are
--   used.
setSeverities :: MonadIO m => LoggerName -> Severities -> m ()

-- | Set or clear severities.
setSeveritiesMaybe :: MonadIO m => LoggerName -> Maybe Severities -> m ()

-- | Updates the global record for the given logger to take into account
--   any changes you may have made.
saveGlobalLogger :: MonadIO m => Logger -> m ()

-- | Helps you make changes on the given logger. Takes a function that
--   makes changes and writes those changes back to the global database.
--   Here's an example from above ("s" is a <a>LogHandler</a>):
--   
--   <pre>
--   updateGlobalLogger "MyApp.BuggyComponent"
--                      (setLevel DEBUG . setHandlers [s])
--   </pre>
updateGlobalLogger :: MonadIO m => LoggerName -> (Logger -> Logger) -> m ()

-- | Sets file prefix to <a>LogInternalState</a>.
setPrefix :: MonadIO m => Maybe FilePath -> m ()

-- | Retrieves content of log file(s) given path (w/o
--   <tt>_lcFilePrefix</tt>, as specified in your config). Example: there's
--   <tt>component.log</tt> in config, but this function will return
--   <tt>[component.log.122, component.log.123]</tt> if you want to.
--   Content is file lines newest first.
--   
--   FYI: this function is implemented to avoid the following problem:
--   log-warper holds open handles to files, so trying to open log file for
--   read would result in <tt>IOException</tt>.
retrieveLogContent :: (MonadIO m) => FilePath -> Maybe Int -> m [Text]
instance GHC.Generics.Generic System.Wlog.IOLogger.LogInternalState
instance GHC.Generics.Generic System.Wlog.IOLogger.Logger


-- | Type class that add ability to log messages. Supports pure and IO
--   logging.
module System.Wlog.CanLog

-- | Instances of this class should explain how they add messages to their
--   log.
class Monad m => CanLog m
dispatchMessage :: CanLog m => LoggerName -> Severity -> Text -> m ()
dispatchMessage :: (CanLog m, MonadTrans t, t n ~ m, CanLog n) => LoggerName -> Severity -> Text -> m ()

-- | Type alias for constraints <a>CanLog</a> and <a>HasLoggerName</a>. We
--   need two different type classes to support more flexible interface but
--   in practice we usually use them both.
type WithLogger m = (CanLog m, HasLoggerName m)

-- | Type alias for constraints <a>WithLogger</a> and <a>MonadIO</a>. It is
--   a very common situation to use both of them together.
type WithLoggerIO m = (MonadIO m, WithLogger m)

-- | Shortcut for <a>logMessage</a> to use according severity.
logDebug :: WithLogger m => Text -> m ()

-- | Shortcut for <a>logMessage</a> to use according severity.
logError :: WithLogger m => Text -> m ()

-- | Shortcut for <a>logMessage</a> to use according severity.
logInfo :: WithLogger m => Text -> m ()

-- | Shortcut for <a>logMessage</a> to use according severity.
logNotice :: WithLogger m => Text -> m ()

-- | Shortcut for <a>logMessage</a> to use according severity.
logWarning :: WithLogger m => Text -> m ()

-- | Logs message with specified severity using logger name in context.
logMessage :: WithLogger m => Severity -> Text -> m ()

-- | It's very common situation when we need to write log messages inside
--   functions that work in <a>IO</a>.
--   
--   To do so we need to configure logger name each time inside work of
--   this function.
--   
--   <tt>liftLogIO</tt> is the easiest way to deal with such kind of
--   situations.
--   
--   <h4><b>Usage Example</b></h4>
--   
--   We have some function
--   
--   <pre>
--   clientStart :: HostName -&gt; .. -&gt; IO ClientComponentMap
--   clientStart hostName .. = do
--       ...
--       forkIO $ routeIncoming endPoint msgs
--       ...
--   </pre>
--   
--   We need to log <a>Error</a> messages in <tt>routeIncoming</tt>
--   function. To do that we firstly need <tt>clientStart</tt> to work in
--   <a>MonadIO</a>
--   
--   <pre>
--   clientStart :: (MonadIO m) =&gt; HostName -&gt; .. -&gt; m ClientComponentMap
--   clientStart hostName .. = do
--       ...
--       liftIO $ forkIO $ routeIncoming endPoint msgs
--       ...
--   </pre>
--   
--   After we added some <a>logError</a> into <tt>routeIncoming</tt>
--   <tt>clientStart</tt> should now work in <a>WithLogger</a>. Thus we can
--   use <a>WithLoggerIO</a> which is combination of <a>MonadIO</a> and
--   <a>WithLogger</a>. Taking into consideration all above we get:
--   
--   <pre>
--   clientStart :: WithLoggerIO m =&gt; HostName -&gt; .. -&gt; m ClientComponentMap
--   clientStart hostName .. = do
--       ...
--       logName &lt;- askLoggerName
--       liftIO $ forkIO $ usingLoggerName logName $ routeIncoming endPoint msgs
--       ...
--   </pre>
--   
--   So, here we see how useful this function can be.
--   
--   <pre>
--   clientStart :: WithLoggerIO m =&gt; HostName -&gt; .. -&gt; m ClientComponentMap
--   clientStart hostName .. = do
--       ...
--       liftLogIO forkIO $ routeIncoming endPoint msgs
--       ...
--   </pre>
liftLogIO :: WithLoggerIO m => (IO a -> IO b) -> LoggerNameBox IO a -> m b
instance System.Wlog.CanLog.CanLog GHC.Types.IO
instance System.Wlog.CanLog.CanLog m => System.Wlog.CanLog.CanLog (System.Wlog.LoggerNameBox.LoggerNameBox m)
instance System.Wlog.CanLog.CanLog m => System.Wlog.CanLog.CanLog (Control.Monad.Trans.Reader.ReaderT r m)
instance System.Wlog.CanLog.CanLog m => System.Wlog.CanLog.CanLog (Control.Monad.Trans.State.Strict.StateT s m)
instance System.Wlog.CanLog.CanLog m => System.Wlog.CanLog.CanLog (Control.Monad.Trans.State.Lazy.StateT s m)
instance System.Wlog.CanLog.CanLog m => System.Wlog.CanLog.CanLog (Control.Monad.Trans.Except.ExceptT s m)
instance (System.Wlog.CanLog.CanLog m, GHC.Base.Monoid w) => System.Wlog.CanLog.CanLog (Control.Monad.Trans.RWS.Lazy.RWST r w s m)
instance (System.Wlog.CanLog.CanLog m, GHC.Base.Monoid w) => System.Wlog.CanLog.CanLog (Control.Monad.Trans.RWS.Strict.RWST r w s m)


-- | This module supports pure logging.
module System.Wlog.PureLogging

-- | Pure implementation of <a>CanLog</a> type class. Instead of writing
--   log messages into console it appends log messages into <a>StateT</a>
--   log. It uses <tt>DList</tt> for better performance, because messages
--   can be added only at the end of log. But it uses
--   <tt>unsafePerformIO</tt> so use with caution within IO.
--   
--   TODO: Should we use some <tt>Data.Tree</tt>-like structure to observe
--   message only by chosen logger names?
newtype PureLogger m a
PureLogger :: StateT (Seq LogEvent) m a -> PureLogger m a
[runPureLogger] :: PureLogger m a -> StateT (Seq LogEvent) m a

-- | Holds all required information for <tt>dispatchLoggerName</tt>
--   function.
data LogEvent
LogEvent :: !LoggerName -> !Severity -> !Text -> LogEvent
[leLoggerName] :: LogEvent -> !LoggerName
[leSeverity] :: LogEvent -> !Severity
[leMessage] :: LogEvent -> !Text

-- | Logs all <tt>LogEvent'</tt>s from given list. This function supposed
--   to be used after <a>runPureLog</a>.
dispatchEvents :: CanLog m => [LogEvent] -> m ()

-- | Logs all <tt>LogEvent'</tt>s from given list. Just like
--   <a>dispatchEvents</a> but uses proper logger Name.
logEvents :: WithLogger m => [LogEvent] -> m ()

-- | Return log of pure logging action as list of <a>LogEvent</a>.
runPureLog :: Functor m => PureLogger m a -> m (a, [LogEvent])

-- | Performs actual logging once given action completes.
launchPureLog :: (CanLog n, Monad m) => (forall f. Functor f => m (f a) -> n (f b)) -> PureLogger m a -> n b
newtype NamedPureLogger m a
NamedPureLogger :: PureLogger (LoggerNameBox m) a -> NamedPureLogger m a
[runNamedPureLogger] :: NamedPureLogger m a -> PureLogger (LoggerNameBox m) a

-- | Return log of pure logging action as list of <a>LogEvent</a>, using
--   logger name provided by context.
runNamedPureLog :: (Monad m, HasLoggerName m) => NamedPureLogger m a -> m (a, [LogEvent])

-- | Similar to <a>launchPureLog</a>, but provides logger name from current
--   context.
--   
--   Running the <a>NamedPureLogger</a> gives us the pair of target and the
--   list of <a>LogEvent</a>s, wrapped in <a>Monad</a> from where using the
--   fact that <tt>(,)</tt> is <a>Functor</a> logging can be triggered.
--   
--   <h4><b>Example</b></h4>
--   
--   <pre>
--   newtype PureSmth a = ...
--       deriving (MonadSmth, ...)
--   
--   instance MonadSmth m =&gt; MonadSmt (NamedLoggerName m)
--   
--   evalPureSmth :: PureSmth a -&gt; a
--   
--   makeField    :: MonadSmth m =&gt; Data -&gt; m Field
--   
--   run :: (MonadIO m, WithLogger m) =&gt; m ()
--   run = do
--       data  &lt;- getData
--       -- field :: Field
--       field &lt;- launchNamedPureLog (pure . evalPureSmth) (makeField data)
--       --       ^ logging happens here
--       ...
--   </pre>
launchNamedPureLog :: (WithLogger n, Monad m) => (forall f. Functor f => m (f a) -> n (f b)) -> NamedPureLogger m a -> n b

-- | Similar to <a>launchNamedPureLog</a>, but calls <a>pure</a> on passed
--   function result.
--   
--   <h4><b>Example</b></h4>
--   
--   The example from <a>launchNamedPureLog</a> with usage of this function
--   will look like:
--   
--   <pre>
--   newtype PureSmth a = ...
--       deriving (MonadSmth, ...)
--   
--   instance MonadSmth m =&gt; MonadSmt (NamedLoggerName m)
--   
--   evalPureSmth :: PureSmth a -&gt; a
--   
--   makeField    :: MonadSmth m =&gt; Data -&gt; m Field
--   
--   run :: (MonadIO m, WithLogger m) =&gt; m ()
--   run = do
--       data  &lt;- getData
--       -- field :: Field
--       field &lt;- launchNamedPureLogWith evalPureSmth $ makeField data
--       --       ^ logging happens here
--       ...
--   </pre>
launchNamedPureLogWith :: (WithLogger n, Monad m) => (forall f. Functor f => m (f a) -> f b) -> NamedPureLogger m a -> n b

-- | Similar to <a>runNamedPureLog</a>, but using provided logger name.
usingNamedPureLogger :: Functor m => LoggerName -> NamedPureLogger m a -> m (a, [LogEvent])

-- | Perform pure-logging computation, log its events and return the result
--   of the computation
logPureAction :: WithLogger m => NamedPureLogger m a -> m a
instance GHC.Base.Monad m => System.Wlog.HasLoggerName.HasLoggerName (System.Wlog.PureLogging.NamedPureLogger m)
instance Control.Monad.Catch.MonadThrow m => Control.Monad.Catch.MonadThrow (System.Wlog.PureLogging.NamedPureLogger m)
instance GHC.Base.Monad m => Control.Monad.State.Class.MonadState (Data.Sequence.Internal.Seq System.Wlog.PureLogging.LogEvent) (System.Wlog.PureLogging.NamedPureLogger m)
instance GHC.Base.Monad m => GHC.Base.Monad (System.Wlog.PureLogging.NamedPureLogger m)
instance GHC.Base.Monad m => GHC.Base.Applicative (System.Wlog.PureLogging.NamedPureLogger m)
instance GHC.Base.Functor m => GHC.Base.Functor (System.Wlog.PureLogging.NamedPureLogger m)
instance (System.Wlog.HasLoggerName.HasLoggerName m, GHC.Base.Monad m) => System.Wlog.HasLoggerName.HasLoggerName (System.Wlog.PureLogging.PureLogger m)
instance Control.Monad.Catch.MonadThrow m => Control.Monad.Catch.MonadThrow (System.Wlog.PureLogging.PureLogger m)
instance GHC.Base.Monad m => Control.Monad.State.Class.MonadState (Data.Sequence.Internal.Seq System.Wlog.PureLogging.LogEvent) (System.Wlog.PureLogging.PureLogger m)
instance Control.Monad.Trans.Class.MonadTrans System.Wlog.PureLogging.PureLogger
instance GHC.Base.Monad m => GHC.Base.Monad (System.Wlog.PureLogging.PureLogger m)
instance GHC.Base.Monad m => GHC.Base.Applicative (System.Wlog.PureLogging.PureLogger m)
instance GHC.Base.Functor m => GHC.Base.Functor (System.Wlog.PureLogging.PureLogger m)
instance GHC.Show.Show System.Wlog.PureLogging.LogEvent
instance Control.Monad.Trans.Class.MonadTrans System.Wlog.PureLogging.NamedPureLogger
instance GHC.Base.Monad m => System.Wlog.CanLog.CanLog (System.Wlog.PureLogging.NamedPureLogger m)
instance Control.Monad.Morph.MFunctor System.Wlog.PureLogging.NamedPureLogger
instance GHC.Base.Monad m => System.Wlog.CanLog.CanLog (System.Wlog.PureLogging.PureLogger m)
instance Control.Monad.Morph.MFunctor System.Wlog.PureLogging.PureLogger


-- | This module deals with Exception logging.
module System.Wlog.Exception

-- | Logs exception's description with '<a>Error</a> <a>Severity</a>
logException :: forall e m. (WithLogger m, Exception e) => e -> m ()

-- | Runs the action, if an exception is raised the <a>logException</a> is
--   executed.
--   
--   <h4><b>Example</b></h4>
--   
--   Here is very simple example of usage <a>catchLog</a> on IO functions:
--   
--   <pre>
--   main :: IO ()
--   main = do
--       buildAndSetupYamlLogging productionB "log-config.yaml"
--       usingLoggerName "new-logger" runWithExceptionLog
--   
--   runWithExceptionLog :: (WithLoggerIO m, MonadCatch m) =&gt; m ()
--   runWithExceptionLog = catchLog @IOException (liftIO simpleIOfun)
--   
--   simpleIOfun :: IO ()
--   simpleIOfun = getLine &gt;&gt;= readFile &gt;&gt;= putStrLn
--   </pre>
--   
--   and when run you will get:
--   
--   <pre>
--   &gt;&gt;&gt; run-main-from-this-example
--   &gt; not-existing-filename.txt
--   [new-logger:ERROR] [2017-12-01 13:07:33.21 UTC] asd: openFile: does not exist (No such file or directory)
--   </pre>
catchLog :: forall e m. (WithLoggerIO m, MonadCatch m, Exception e) => m () -> m ()


-- | This module introduces functions that allow to run action in parallel
--   with logging.
module System.Wlog.Concurrent

-- | Data type to represent waiting strategy for printing warnings if
--   action take too much time.
data WaitingDelta

-- | wait s seconds and stop execution
WaitOnce :: (Time Second) -> WaitingDelta

-- | wait s, s * 2, s * 3 , s * 4 , ... seconds
WaitLinear :: (Time Second) -> WaitingDelta

-- | wait m, m * q, m * q^2, m * q^3, ... microseconds
WaitGeometric :: (Time Second) -> RatioNat -> WaitingDelta

-- | Constraint for something that can be logged in parallel with other
--   action.
type CanLogInParallel m = (MonadBaseControl IO m, WithLoggerIO m)

-- | Run action and print warning if it takes more time than expected.
logWarningLongAction :: forall m a. CanLogInParallel m => (Text -> m ()) -> WaitingDelta -> Text -> m a -> m a

-- | Specialization of <a>logWarningLongAction</a> with <a>WaitOnce</a>.
logWarningWaitOnce :: CanLogInParallel m => Time Second -> Text -> m a -> m a

-- | Specialization of <a>logWarningLongAction</a> with <tt>WaiLinear</tt>.
logWarningWaitLinear :: CanLogInParallel m => Time Second -> Text -> m a -> m a

-- | Specialization of <a>logWarningLongAction</a> with
--   <a>WaitGeometric</a> with parameter <tt>1.3</tt>. Accepts
--   <a>Second</a>.
logWarningWaitInf :: CanLogInParallel m => Time Second -> Text -> m a -> m a
instance GHC.Show.Show System.Wlog.Concurrent.WaitingDelta


-- | Logging functionality. This module is wrapper over <a>hslogger</a>,
--   which allows to keep logger name in monadic context.
module System.Wlog.Terminal

-- | 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
--   <a>setupLogging</a>.
--   
--   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 <i>stdout</i>. 1.2. Moreover messages with at least
--   <tt>Error</tt> severity are printed to <i>stderr</i>. 2. Sets given
--   Severity to root logger, so that it will be used by descendant loggers
--   by default. 3. Applies <tt>setSeverity</tt> to given loggers. It can
--   be done later using <tt>setSeverity</tt> directly.
initTerminalLogging :: MonadIO m => (UTCTime -> Text) -> (Handle -> Text -> IO ()) -> Bool -> Bool -> Maybe Severities -> Maybe Severities -> m ()


-- | Parser for configuring and initializing logger from YAML file. Logger
--   configuration should look like this:
--   
--   <pre>
--   rotation:                    # [optional] parameters for logging rotation
--       logLimit: 1024           # max size of log file in bytes
--       keepFiles: 3             # number of files with logs to keep including current one
--   loggerTree:
--       severity: Warning+       # severities for «root» logger
--       node:                    # logger named «node»
--           severity: Warning+   # severities for logger «node»
--           comm:                # logger named «node.comm»
--               severity: Info+  # severity for logger «node.comm»
--               file: patak.jpg  # messages will be also printed to patak.jpg
--   </pre>
--   
--   And this configuration corresponds two loggers with
--   <tt>LoggerName'</tt>s <tt>node</tt> and <tt>node.comm</tt>.
module System.Wlog.Launcher

-- | Applies given builder to parsed logger config and initializes logging.
buildAndSetupYamlLogging :: MonadIO m => LoggerConfig -> FilePath -> m ()

-- | Default logging configuration with the given <a>LoggerName</a>.
--   
--   Enabled flags:
--   
--   <ul>
--   <li><a>ltSeverity</a> of the root logger is set to <a>warningPlus</a>
--   (<a>Warning</a> and upper)</li>
--   <li><a>ltSeverity</a> for the given logger is set to <a>debugPlus</a>
--   (<a>Debug</a> and upper)</li>
--   <li><a>lcShowTime</a> is set to 'Any True' which means that time is
--   shown in the log messages.</li>
--   <li><a>lcConsoleAction</a> is set to <a>defaultHandleAction</a> which
--   turns the console output on.</li>
--   </ul>
--   
--   <h4><b><i>Example</i></b></h4>
--   
--   <tt> defaultConfig "example"</tt> will produce such configurations:
--   
--   <pre>
--   rotation: null
--   showTid: false
--   showTime: true
--   printOutput: true
--   logTree:
--     _ltSubloggers:
--       example:
--         _ltSubloggers: {}
--         _ltSeverity:
--         - Debug
--         - Info
--         - Notice
--         - Warning
--         - Error
--         _ltFiles: []
--     _ltSeverity:
--     - Warning
--     - Error
--     _ltFiles: []
--   termSeveritiesOut: null
--   filePrefix: null
--   termSeveritiesErr: null
--   </pre>
defaultConfig :: LoggerName -> LoggerConfig

-- | Initializes logging using given <a>FilePath</a> to logger
--   configurations, runs the action with the given <a>LoggerName</a>.
launchFromFile :: (MonadIO m, MonadMask m) => FilePath -> LoggerName -> LoggerNameBox m a -> m a

-- | Set ups the logging with <a>defaultConfig</a> and runs the action with
--   the given <a>LoggerName</a>.
--   
--   <h4><b><i>Example</i></b></h4>
--   
--   Here we can see very simple working example of logging:
--   
--   <pre>
--   ghci&gt; <b>:{</b>
--   ghci| <b>launchSimpleLogging "app" $ do</b>
--   ghci|     <b>logDebug "Debug message"</b>
--   ghci|     <b>putStrLn "Usual printing"</b>
--   ghci|     <b>logInfo "Job's done!"</b>
--   ghci| <b>:}</b>
--   [app:DEBUG] [2017-12-07 11:25:06.47 UTC] Debug message
--   Usual printing
--   [app:INFO] [2017-12-07 11:25:06.47 UTC] Job's done!
--   </pre>
launchSimpleLogging :: (MonadIO m, MonadMask m) => LoggerName -> LoggerNameBox m a -> m a

-- | Sets up given logging configurations, runs the action with the given
--   <a>LoggerName</a>.
launchWithConfig :: (MonadIO m, MonadMask m) => LoggerConfig -> LoggerName -> LoggerNameBox m a -> m a

-- | Parses logger config from given file path.
parseLoggerConfig :: MonadIO m => FilePath -> m LoggerConfig

-- | This function traverses <a>LoggerConfig</a> initializing all
--   subloggers with <a>Severities</a> and redirecting output in file
--   handlers. See <a>LoggerConfig</a> for more details.
setupLogging :: MonadIO m => Maybe (UTCTime -> Text) -> LoggerConfig -> m ()


-- | Logging functionality. This module is wrapper over <a>hslogger</a>,
--   which allows to keep logger name in monadic context. Messages are
--   colored depending on used serverity.
module System.Wlog
