log4hs-0.0.4.0: A python logging style log library

Safe HaskellSafe
LanguageHaskell2010

Logging.Types

Synopsis

Documentation

type Logger = String Source #

Logger is just a name.

newtype Level Source #

Level also known as severity, a higher Level means a bigger Int.

Constructors

Level Int 
Instances
Enum Level Source # 
Instance details

Defined in Logging.Types

Eq Level Source # 
Instance details

Defined in Logging.Types

Methods

(==) :: Level -> Level -> Bool #

(/=) :: Level -> Level -> Bool #

Ord Level Source # 
Instance details

Defined in Logging.Types

Methods

compare :: Level -> Level -> Ordering #

(<) :: Level -> Level -> Bool #

(<=) :: Level -> Level -> Bool #

(>) :: Level -> Level -> Bool #

(>=) :: Level -> Level -> Bool #

max :: Level -> Level -> Level #

min :: Level -> Level -> Level #

Read Level Source # 
Instance details

Defined in Logging.Types

Show Level Source # 
Instance details

Defined in Logging.Types

Methods

showsPrec :: Int -> Level -> ShowS #

show :: Level -> String #

showList :: [Level] -> ShowS #

IsString Level Source # 
Instance details

Defined in Logging.Types

Methods

fromString :: String -> Level #

Lift Level Source # 
Instance details

Defined in Logging.Types

Methods

lift :: Level -> Q Exp #

FromJSON Level Source # 
Instance details

Defined in Logging.Aeson

Default Level Source # 
Instance details

Defined in Logging.Types

Methods

def :: Level #

data LogRecord Source #

A LogRecord represents an event being logged.

LogRecords are created every time something is logged. They contain all the information related to the event being logged.

It includes the main message as well as information such as when the record was created, the source line where the logging call was made.

data Filter Source #

Filters are used to perform arbitrary filtering of LogRecords.

Sinks and Handlers can optionally use Filter to filter records as desired. It allows events which are below a certain point in the sink hierarchy. For example, a filter initialized with A.B will allow events logged by loggers A.B, A.B.C, A.B.C.D, A.B.D etc. but not A.BB, B.A.B etc. If initialized name with the empty string, all events are passed.

Constructors

Filter 

Fields

Instances
Eq Filter Source # 
Instance details

Defined in Logging.Types

Methods

(==) :: Filter -> Filter -> Bool #

(/=) :: Filter -> Filter -> Bool #

IsString Filter Source # 
Instance details

Defined in Logging.Types

Methods

fromString :: String -> Filter #

FromJSON Filter Source # 
Instance details

Defined in Logging.Aeson

Filterable Filter Source # 
Instance details

Defined in Logging.Types

type Filterer = [Filter] Source #

List of Filter

data Formatter Source #

Formatters are used to convert a LogRecord to text.

Formatters need to know how a LogRecord is constructed. They are responsible for converting a LogRecord to (usually) a string which can be interpreted by either a human or an external system. The base Formatter allows a formatting string to be specified. If none is supplied, the default value, "%(message)s" is used.

The Formatter can be initialized with a format string which makes use of knowledge of the LogRecord attributes - e.g. the default value mentioned above makes use of a LogRecord's message attribute. Currently, the useful attributes in a LogRecord are described by:

%(logger)s
Name of the logger (logging channel)
%(level)s
Numeric logging level for the message (DEBUG, INFO, WARN, ERROR, FATAL, LEVEL v)
%(pathname)s
Full pathname of the source file where the logging call was issued (if available)
%(filename)s
Filename portion of pathname
%(module)s
Module (name portion of filename)
%(lineno)d
Source line number where the logging call was issued (if available)
%(created)f
Time when the LogRecord was created (picoseconds since '1970-01-01 00:00:00')
%(asctime)s
Textual time when the LogRecord was created
%(msecs)d
Millisecond portion of the creation time
%(message)s
The main message passed to logv debug info ..

Constructors

Formatter 

Fields

Instances
Eq Formatter Source # 
Instance details

Defined in Logging.Types

FromJSON Formatter Source # 
Instance details

Defined in Logging.Aeson

Default Formatter Source # 
Instance details

Defined in Logging.Types

Methods

def :: Formatter #

Formattable Formatter Source # 
Instance details

Defined in Logging.Types

FromJSON (Map String Formatter -> IO HandlerT) Source # 
Instance details

Defined in Logging.Aeson

data StreamHandler Source #

A handler type which writes logging records, appropriately formatted, to a stream.

Note that this class does not close the stream when the stream is a terminal device, e.g. stderr and stdout.

Note: FileHandler is an alias of StreamHandler

Constructors

StreamHandler 

data HandlerT where Source #

A GADT represents any Handler instance

Constructors

HandlerT :: Handler a => a -> HandlerT 

data Sink Source #

Sink represents a single logging channel.

A "logging channel" indicates an area of an application. Exactly how an "area" is defined is up to the application developer. Since an application can have any number of areas, logging channels are identified by a unique string. Application areas can be nested (e.g. an area of "input processing" might include sub-areas "read CSV files", "read XLS files" and "read Gnumeric files"). To cater for this natural nesting, channel names are organized into a namespace hierarchy where levels are separated by periods, much like the Haskell module namespace. So in the instance given above, channel names might be Input for the upper level, and Input.Csv, Input.Xls and Input.Gnu for the sub-levels. There is no arbitrary limit to the depth of nesting.

Note: The namespaces are case sensitive.

Constructors

Sink 
Instances
FromJSON Sink Source # 
Instance details

Defined in Logging.Aeson

Filterable Sink Source # 
Instance details

Defined in Logging.Types

Methods

filter :: Sink -> LogRecord -> Bool Source #

FromJSON (String -> Map String HandlerT -> Sink) Source # 
Instance details

Defined in Logging.Aeson

data Manager Source #

There is under normal circumstances just one Manager, which holds the hierarchy of sinks.

Instances
FromJSON (IO Manager) Source # 
Instance details

Defined in Logging.Aeson

class Filterable a where Source #

A class represents a common trait of filtering LogRecords

Methods

filter :: a -> LogRecord -> Bool Source #

Instances
Filterable Sink Source # 
Instance details

Defined in Logging.Types

Methods

filter :: Sink -> LogRecord -> Bool Source #

Filterable Filter Source # 
Instance details

Defined in Logging.Types

Filterable a => Filterable [a] Source # 
Instance details

Defined in Logging.Types

Methods

filter :: [a] -> LogRecord -> Bool Source #

class Formattable a where Source #

A class represents a common trait of formatting LogRecord as String.