katip-0.4.1.0: A structured logging framework.

Safe HaskellNone
LanguageHaskell2010

Katip.Scribes.Handle

Synopsis

Documentation

brackets :: Builder -> Builder Source

getKeys :: LogItem s => Verbosity -> s -> [Builder] Source

data ColorStrategy Source

Constructors

ColorLog Bool

Whether to use color control chars in log output

ColorIfTerminal

Color if output is a terminal

data WorkerCmd Source

Constructors

NewItem Builder 
PoisonPill 

mkHandleScribe :: ColorStrategy -> Handle -> Severity -> Verbosity -> IO (Scribe, IO ()) Source

Logs to a file handle such as stdout, stderr, or a file. Contexts and other information will be flattened out into bracketed fields. For example:

[2016-05-11 21:01:15][MyApp][Info][myhost.example.com][1724][ThreadId 1154][main:Helpers.Logging Helpers/Logging.hs:32:7] Started
[2016-05-11 21:01:15][MyApp.confrabulation][Debug][myhost.example.com][1724][ThreadId 1154][confrab_factor:42.0][main:Helpers.Logging Helpers/Logging.hs:41:9] Confrabulating widgets, with extra namespace and context
[2016-05-11 21:01:15][MyApp][Info][myhost.example.com][1724][ThreadId 1154][main:Helpers.Logging Helpers/Logging.hs:43:7] Namespace and context are back to normal

Returns the newly-created Scribe together with a finaliser the user needs to run to perform resource cleanup.

formatItem :: LogItem a => Bool -> Verbosity -> Item a -> Builder Source

ioLogEnv :: Severity -> Verbosity -> IO LogEnv Source

Provides a simple log environment with 1 scribe going to stdout. This is a decent example of how to build a LogEnv and is best for scripts that just need a quick, reasonable set up to log to stdout.