-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[RFC] HoistLogAction with MVar #44
Comments
Hi @yhuangsh, maybe I'm not experienced enough or didn't fully understand the intended usage - or need some more time to think about this, but at a first look the design seems somehow strange to me. I can understand the first bullet point, but this could be a simple |
hi @alaendle, my use case boils down to one admin thread and a number of other threads for various server functions, each implemented in its own unique Monad transformer stack which in turn includes a LogAction, conceptually wrapped in a ReaderT layer of the stack. The admin thread supplies the LogActions to these server threads at launch, and may want to change level of verbosity for all or some of the servers. For example, turning on Debug if some server isn’t working properly. Using MVar is just standard way to transport a LogAction from the admin thread to the server threads, nothing fancy here. The admin thread does use some of the combinators (I used filterBySeverity) to filter logs or apply other transforms on the base LogAction, then transport the modified LogAction to target servers via MVars. Hope this explain my use case. I’m sure it’s not the only way to do it. |
Thanks @yhuangsh for the additional explanation. However I'm not sure about your intention. Did you just seek feedback regarding your usage of the library? Or was the intention that we should included something like the mentioned functions in the library? Without having all the details of your code it's really hard fully assess your approach; I would say, if it works for you it's fine - at least I see no obvious reason why it could be problematic. Personally I still tend to think that the complete switch of the action might be too powerful approach to be promoted as a general pattern. |
Case use:
Every log action will involve additional IO (readMVar), performance impact not assessed.
Appreciate comments
The text was updated successfully, but these errors were encountered: