simple-log-0.1.1: Simple log for Haskell

Safe HaskellNone

System.Log.Base

Synopsis

Documentation

data Level Source

Level of message

Constructors

Trace 
Debug 
Info 
Warning 
Error 
Fatal 

data Politics Source

Scope politics

Constructors

Politics 

data Rule Source

Rule for politics

Constructors

Rule 

type Rules = [Rule]Source

defaultPolitics :: PoliticsSource

Default politics

debugPolitics :: PoliticsSource

Debug politics

tracePolitics :: PoliticsSource

Trace politics

silentPolitics :: PoliticsSource

Silent politics

rule :: ([Text] -> Bool) -> (Politics -> Politics) -> RuleSource

Make rule

absolute :: [Text] -> [Text] -> BoolSource

Absolute scope-path

relative :: [Text] -> [Text] -> BoolSource

Relative scope-path

child :: ([Text] -> Bool) -> [Text] -> BoolSource

Scope-path for child

root :: [Text] -> BoolSource

Root scope-path

path :: Text -> [Text] -> BoolSource

Scope-path by text

 / -- root
 foo/bar -- relative
 /foo/bar -- absolute
 foo/bar/ -- child of relative
 /foo/bar/ -- child of absolute

(%=) :: Text -> (Politics -> Politics) -> RuleSource

Rule by path

politics :: Level -> Level -> Politics -> PoliticsSource

Just set new politics

use :: Politics -> Politics -> PoliticsSource

Use predefined politics

low :: Level -> Politics -> PoliticsSource

Set new low level

high :: Level -> Politics -> PoliticsSource

Set new high level

data Message Source

Log message

data Converter a Source

Converts message some representation

Constructors

Converter 

Fields

initial :: a
 
convert :: Message -> a
 

data Consumer a Source

Constructors

Consumer 

Fields

consumerNew :: Bool
 
consume :: a -> IO ()
 
consumerClose :: IO ()
 

data Entry Source

Log entry, scope or message

Constructors

Entry Message 
Scope Text Rules [Entry] 

data Command Source

Command to logger

entries :: [Command] -> [Entry]Source

Apply commands to construct list of entries

flatten :: [Entry] -> [Message]Source

Flattern entries to raw list of messages

rules :: Rules -> [Text] -> [Entry] -> [Entry]Source

Apply rules

data Logger Source

Logger

Constructors

Logger 

Fields

loggerLog :: Message -> IO ()
 
loggerClose :: IO ()
 

logger :: Converter a -> IO (Consumer a) -> IO LoggerSource

Convert consumer creater to logger creater

type RulesLoad = IO (IO Rules)Source

Type to initialize rule updater

data Log Source

Log

Constructors

Log 

Fields

logPost :: Command -> IO ()
 
logRules :: IO Rules
 

noLog :: LogSource

Empty log

newLog :: RulesLoad -> [IO Logger] -> IO LogSource

Create log

writeLog :: Log -> Level -> Text -> IO ()Source

Write message to log

scopeLog_ :: Log -> Text -> IO a -> IO aSource

New log-scope

scopeLog :: Log -> Text -> IO a -> IO aSource

New log-scope with lifting exceptions as errors

scoperLog :: Show a => Log -> Text -> IO a -> IO aSource

New log-scope with tracing scope result