-
Notifications
You must be signed in to change notification settings - Fork 49
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] Add new action that allows to print text messages with timestamp and thread id but without severity #119
Comments
@chshersh if you don't mind, I'd like to take a stab at this if the proposal is accepted. |
@sphaso This will be a good addition to the library. I think that the proposal currently in its final form, so feel free to work on that 🙂 |
@chshersh I've changed the RichMsg data type and added the RichMessage type as suggested above (had to include the DeriveFunctor extension). The build is clean and tests pass. Is output not tested? I seem to remember it was. Do you have any pointer on how to test this change properly? |
@sphaso Try to run the In order to check the new behaviour, you need to patch code in the |
@chshersh sorry to keep bothering you. I thought of different ways of going about this but I lack some experience with the library. Since the RichMsg type now has a type parameter for the message, I assume you were thinking about creating a new (e.g.) |
@sphaso No problems! This issue is not that straightforward and has open space for solutions.
No need for this. You can keep fmtSimpleRichMessageDefault :: RichMessage Text -> m Text So it will be only text, timestamp and thread id |
#128) * [#119] new action that logs a message without the severity information * useless UNPACK pragma * Update co-log/src/Colog/Message.hs Co-Authored-By: Dmitrii Kovanikov <kovanikov@gmail.com> * Update co-log/src/Colog/Message.hs Co-Authored-By: Dmitrii Kovanikov <kovanikov@gmail.com> * Fixed indentation and function types * fixed where indentation * examples are working with polymorphic formatter for SimpleMsg * upgradeMessageAction is generic, fixed tutorial accordingly
Currently in order to print message with timestamp, you need to use
Message
data type which forces you to also specify severity. However, I may see that it might be more convenient sometimes to specify only textual payload and get the timestamp (and maybe thread id) automatically. This may help with moving fromputStrLn
toco-log
easier.The way to resolve this issue that I see is to change
RichMessage
data type. Currently it has the following shape:https://github.com/kowainik/co-log/blob/1d700e04d73b544b871d42322e2f516f3b78c22a/co-log/src/Colog/Message.hs#L264-L268
I propose to perform the same thing that was done with the
Message
data type, specifically, change it to the following data type:We need to change types of couple extra functions and implement some formatting in case of textual data (the last one is tricky). Otherwise should be straightforward.
The text was updated successfully, but these errors were encountered: