Safe Haskell | None |
---|---|
Language | Haskell2010 |
Network.IRC.Fun.Client.ChannelLogger
- data Logger
- data ChanLogEvent
- data LogEvent
- logFilePath :: FilePath -> String -> ChannelName -> FilePath
- newLogger :: IO String -> FilePath -> IO Logger
- removeLogger :: Logger -> IO ()
- logEvent :: Logger -> ChanLogEvent -> IO ()
- fromClientEvent :: Event -> Maybe LogEvent
Documentation
data ChanLogEvent Source
Constructors
EnterChan NickName | |
LeaveChan NickName | |
MessageChan NickName String | |
RenameInChan NickName NickName |
Instances
Arguments
:: FilePath | Directory in which to place log files. Relative to the program's working directory, or absolute. |
-> String | Server label, e.g. |
-> ChannelName | IRC channel name, e.g. |
-> FilePath |
Utility for constructing a log file path.
Arguments
:: IO String | Action which returns a formatted time string. You can use Network.IRC.Fun.Client.Time to create such an action. |
-> FilePath | Path of the log file |
-> IO Logger |
Create a logger for a given IRC channel.
removeLogger :: Logger -> IO () Source
Flush buffers and release resources.
When the logger is paused for a long period of time (i.e. not momentarily - e.g. by a user disabling channel logging via UI), you can use this to release resources. Later, when logging is needed again, create a fresh new logger.
If your client joins many channels but log few of them, you can save resources by keeping open loggers only for the few logged channels.
logEvent :: Logger -> ChanLogEvent -> IO () Source
Write a log message corresponding to a given event.
fromClientEvent :: Event -> Maybe LogEvent Source
If an IRC client event can be logged, return a matching log event and the channel in which the event has occured.