om-logging-1.1.0.7: Opinionated logging utilities.
Safe HaskellNone
LanguageHaskell2010

OM.Logging

Description

Various combinators for composing "monad-logger" loggers.

Synopsis

Standard OM logging

standardLogging :: LogLevel -> Loc -> LogSource -> LogLevel -> LogStr -> IO () Source #

The standard logging for most OM programs.

withStandardFormat Source #

Arguments

:: LogLevel

The minimum log level that will be logged.

-> (Loc -> LogSource -> LogLevel -> LogStr -> IO ())

The base logger.

-> Loc 
-> LogSource 
-> LogLevel 
-> LogStr 
-> IO () 

Log to the indicated destination, applying the "standard" filters and formats.

Logging Combinators

withTime :: (Loc -> LogSource -> LogLevel -> LogStr -> IO ()) -> Loc -> LogSource -> LogLevel -> LogStr -> IO () Source #

Add timing information to the beginning of logs.

withThread :: (Loc -> LogSource -> LogLevel -> LogStr -> IO ()) -> Loc -> LogSource -> LogLevel -> LogStr -> IO () Source #

Prepend the ThreadId to the beginning of the log.

withLevel :: (Loc -> LogSource -> LogLevel -> LogStr -> IO ()) -> Loc -> LogSource -> LogLevel -> LogStr -> IO () Source #

Add the Logging level to the log output.

withPrefix :: LogStr -> (Loc -> LogSource -> LogLevel -> LogStr -> IO ()) -> Loc -> LogSource -> LogLevel -> LogStr -> IO () Source #

Prefix a fixed string to the log output.

withPackage :: (Loc -> LogSource -> LogLevel -> LogStr -> IO ()) -> Loc -> LogSource -> LogLevel -> LogStr -> IO () Source #

Add the originating package to the log message.

Filters

filterLogging Source #

Arguments

:: (Loc -> LogSource -> LogLevel -> LogStr -> Bool)

The filter to apply.

-> (Loc -> LogSource -> LogLevel -> LogStr -> IO ())

The downstream logging destination.

-> Loc 
-> LogSource 
-> LogLevel 
-> LogStr 
-> IO () 

Filter out some log messages. Only messages matching the predicate are logged to the underlying logger.

levelFilter :: LogLevel -> Loc -> LogSource -> LogLevel -> LogStr -> Bool Source #

levelFilter level is a filter predicate that matches all log messages with level or above.

Destinations

teeLogging Source #

Arguments

:: (Loc -> LogSource -> LogLevel -> LogStr -> IO ())

Destination 1.

-> (Loc -> LogSource -> LogLevel -> LogStr -> IO ())

Destination 2.

-> Loc 
-> LogSource 
-> LogLevel 
-> LogStr 
-> IO () 

Log to more than one logging destination.

stdoutLogging :: Loc -> LogSource -> LogLevel -> LogStr -> IO () Source #

Log messages to stdout. This is very bare bones. It only logs the message itself with no other information. It is meant to be used in conjunction with some of the other combinators, like withLevel.

fdLogging :: Handle -> Loc -> LogSource -> LogLevel -> LogStr -> IO () Source #

Like stdoutLogging, but log to a file handle.

Other types

parseLevel :: Text -> LogLevel Source #

Parse a logging level from a string.

newtype JSONLevel Source #

A FromJSON instance to figure out the logging level.

Constructors

JSONLevel 

Instances

Instances details
FromJSON JSONLevel Source # 
Instance details

Defined in OM.Logging