serokell / log-warper

Logging library to provide more convenient, extremely configurable but simple monadic interface with pretty output
MIT License
19 stars 11 forks source link

[LW-25] Support custom actions with Handlers #29

Closed chshersh closed 7 years ago

chshersh commented 7 years ago

This PR introduces ability to specify custom printing actions to terminal. Unfortunately, is wasn't so trivial. The action should be specified in form Handle -> Text -> IO (). Also this PR refactors some logic in handlers. One redundant MVar for each terminal handler was removed. I hope it works (tested locally, seems to work).

chshersh commented 7 years ago

@int-index Just specify

_lcConsoleAction :: Last (Handle -> Text -> IO ())

using

consoleActionB :: (Handle -> Text -> IO ()) -> LoggerConfig

or

customConsoleActionB :: Maybe (Handle -> Text -> IO ()) -> LoggerConfig
chshersh commented 7 years ago

@volhovM How can I test this?

Ok, but I think you must test writeback functionality: launch local demo and report server, kill all nodes except one, wait until they report. If report server gets logs, it's alright.

Is there described set of commands how to do it? I haven't run or tested cardano-sl for a long time...

volhovm commented 7 years ago

@ChShersh Ok, maybe it makes sense if I do it. Please don't merge before then.