Copyright | (c) Akihito KIRISAKI |
---|---|
License | BSD3 |
Maintainer | Akihito KIRISAKI |
Stability | experimental |
Safe Haskell | None |
Language | Haskell2010 |
Synopsis
- data LogMsg = LogMsg {}
- broadcastLog :: LogQueue -> LogChan -> IO ()
- newtype LogQueue = LogQueue (TQueue LogMsg)
- newLogQueue :: IO LogQueue
- newtype LogChan = LogChan (TChan LogMsg)
- newLogChan :: IO LogChan
- type Formatter = LogMsg -> Builder
- type Listener = LogMsg -> IO ()
- relayLog :: LogChan -> LogLevel -> Listener -> IO ()
- stdoutListener :: Listener
- stdoutListenerWith :: Formatter -> Listener
- terminalListener :: Listener
- handleListener :: Formatter -> Handle -> Listener
- handleListenerFlush :: Formatter -> Handle -> Listener
- defaultFormatter :: Formatter
- terminalFormatter :: Formatter
- data LogLevel
- logAs :: (MonadIO m, ToBuilder s) => LogQueue -> LogLevel -> s -> m ()
- debug :: (MonadIO m, ToBuilder s) => LogQueue -> s -> m ()
- info :: (MonadIO m, ToBuilder s) => LogQueue -> s -> m ()
- notice :: (MonadIO m, ToBuilder s) => LogQueue -> s -> m ()
- warn :: (MonadIO m, ToBuilder s) => LogQueue -> s -> m ()
- err :: (MonadIO m, ToBuilder s) => LogQueue -> s -> m ()
- critical :: (MonadIO m, ToBuilder s) => LogQueue -> s -> m ()
- alert :: (MonadIO m, ToBuilder s) => LogQueue -> s -> m ()
- emergency :: (MonadIO m, ToBuilder s) => LogQueue -> s -> m ()
- class ToBuilder a where
- fix :: Builder -> Builder
- ($:) :: ToBuilder b => (Builder -> b) -> Builder -> b
- (<:>) :: (ToBuilder a, ToBuilder b) => a -> b -> Builder
Basics
Log message.
newLogQueue :: IO LogQueue Source #
Make new LogQueue
newLogChan :: IO LogChan Source #
Make new LogChan
.
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.
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
Log levels. These are matched to syslog.
logAs :: (MonadIO m, ToBuilder s) => LogQueue -> LogLevel -> s -> m () Source #
Push a message to LogQueue
.
Useful string class and operator
class ToBuilder a where Source #
Types which are able to be converted into Builder
BuildertoBuilde
encodes String
and Text
as utf-8.
Instances
Show a => ToBuilder a Source # | |
Defined in System.Log.Caster | |
ToBuilder String Source # | |
ToBuilder ByteString Source # | |
Defined in System.Log.Caster toBuilder :: ByteString -> Builder Source # | |
ToBuilder ByteString Source # | |
Defined in System.Log.Caster toBuilder :: ByteString -> Builder Source # | |
ToBuilder Builder Source # | |
ToBuilder Builder Source # | |
ToBuilder Text Source # | |
ToBuilder Text Source # | |