caster-0.0.2.0: Multicast, thread-safe, and fast logger.

Copyright(c) Akihito KIRISAKI
LicenseBSD3
MaintainerAkihito KIRISAKI
Stabilityexperimental
Safe HaskellNone
LanguageHaskell2010

System.Log.Caster

Contents

Description

 
Synopsis

Basics

data LogMsg Source #

Log message.

broadcastLog :: LogQueue -> LogChan -> IO () Source #

Connect LogQueue and TChan LogMsg.

newtype LogQueue Source #

Queue of LogMsg.

Constructors

LogQueue (TQueue LogMsg) 

newLogQueue :: IO LogQueue Source #

Make new LogQueue

newtype LogChan Source #

Channel of LogMsg.

Constructors

LogChan (TChan LogMsg) 

newLogChan :: IO LogChan Source #

Make new LogChan.

type Formatter = LogMsg -> Builder Source #

Formatter.

type Listener = LogMsg -> IO () Source #

IO function takes LogMsg.

relayLog :: LogChan -> LogLevel -> Listener -> IO () Source #

Listen LogChan and give the LogMsg to given Listener.

Listeners

stdoutListener :: Listener Source #

Stdout listener.

stdoutListenerWith :: Formatter -> Listener Source #

Stdout listener with Formatter.

terminalListener :: Listener Source #

Terminal listener. Log levels are colored.

handleListener :: Formatter -> Handle -> Listener Source #

Make Listener from Handle

handleListenerFlush :: Formatter -> Handle -> Listener Source #

Make Listener flushing buffer after getting LogMsg

Formatter

defaultFormatter :: Formatter Source #

Default log formatter.

terminalFormatter :: Formatter Source #

Formatter for term. It provides colored logs.

Log levels

data LogLevel Source #

Log levels. These are matched to syslog.

Instances
Eq LogLevel Source # 
Instance details

Defined in System.Log.Caster

Ord LogLevel Source # 
Instance details

Defined in System.Log.Caster

Show LogLevel Source # 
Instance details

Defined in System.Log.Caster

logAs :: (MonadIO m, ToBuilder s) => LogQueue -> LogLevel -> s -> m () Source #

Push a message to LogQueue.

debug :: (MonadIO m, ToBuilder s) => LogQueue -> s -> m () Source #

info :: (MonadIO m, ToBuilder s) => LogQueue -> s -> m () Source #

notice :: (MonadIO m, ToBuilder s) => LogQueue -> s -> m () Source #

warn :: (MonadIO m, ToBuilder s) => LogQueue -> s -> m () Source #

err :: (MonadIO m, ToBuilder s) => LogQueue -> s -> m () Source #

critical :: (MonadIO m, ToBuilder s) => LogQueue -> s -> m () Source #

alert :: (MonadIO m, ToBuilder s) => LogQueue -> s -> m () Source #

emergency :: (MonadIO m, ToBuilder s) => LogQueue -> s -> m () Source #

Useful string class and operator

class ToBuilder a where Source #

Types which are able to be converted into Builder Builder toBuilde encodes String and Text as utf-8.

Methods

toBuilder :: a -> Builder Source #

Instances
Show a => ToBuilder a Source # 
Instance details

Defined in System.Log.Caster

Methods

toBuilder :: a -> Builder Source #

ToBuilder String Source # 
Instance details

Defined in System.Log.Caster

ToBuilder ByteString Source # 
Instance details

Defined in System.Log.Caster

ToBuilder ByteString Source # 
Instance details

Defined in System.Log.Caster

ToBuilder Builder Source # 
Instance details

Defined in System.Log.Caster

ToBuilder Builder Source # 
Instance details

Defined in System.Log.Caster

ToBuilder Text Source # 
Instance details

Defined in System.Log.Caster

ToBuilder Text Source # 
Instance details

Defined in System.Log.Caster

fix :: Builder -> Builder Source #

If you turn OverloadedStrings extension on, GHC can't deduce the type of string literal. This function fix the type to Builder Builder without type annotation.

($:) :: ToBuilder b => (Builder -> b) -> Builder -> b infixr 0 Source #

Infix version of fix.

(<:>) :: (ToBuilder a, ToBuilder b) => a -> b -> Builder infixr 6 Source #

Concat ToBuilder strings as Builder Builder.