Skip to content
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

docs: refine the loggert tutorials #272

Merged
merged 2 commits into from
Mar 1, 2024
Merged

Conversation

xieyuschen
Copy link
Member

Changes

  • add a LoggerT monad transformer usage in example
    Previously, the tutorial uses the WithLog env SimpleMsg m => m () function only for usingLoggerT. In my opinion, it's better for the tutorial to state the WithLog env SimpleMsg m => m () and LoggerT SimpleMsg m () is equivalent.
    Hence, I refined this tutorial.
  • update the docs to run the tutorial as the cabal file requires a new flag

Note

  • the LoggerT example cannot print the location correctly. I guess it's normal as inside co-log does additional work for it. I haven't checked further so please correct me if i'm wrong and I will fix the example as well.

Regards

@alaendle
Copy link
Member

Hello @xieyuschen, thanks for your contribution and please excuse the late reply. To be honest I'm not really sure if this improves the documentation around LoggerT - on the one hand, yes, it really tries to build up examples around the transformer; on the other hand, no, it complicates things for newcomer and might be confusing. Unfortunately I still haven't found time to take a deeper look; but I also don't want to delay a reaction further - so please take this as some kind of interim feedback. Regarding the missing location - WithLog enforces HasCallStack - just add HasCallStack as an additional constraint and the location of the log statement should get visible.

@alaendle
Copy link
Member

@xieyuschen - one again, thanks for your contribution - I've changed a few small things - if you still like it, I think we should merge it 👍 otherwise feel free to further improve this PR 😉

@xieyuschen
Copy link
Member Author

Hello @xieyuschen, thanks for your contribution and please excuse the late reply. To be honest I'm not really sure if this improves the documentation around LoggerT - on the one hand, yes, it really tries to build up examples around the transformer; on the other hand, no, it complicates things for newcomer and might be confusing. Unfortunately I still haven't found time to take a deeper look; but I also don't want to delay a reaction further - so please take this as some kind of interim feedback. Regarding the missing location - WithLog enforces HasCallStack - just add HasCallStack as an additional constraint and the location of the log statement should get visible.

Hi @alaendle . sorry for late reply. The motivation of this tutorial is to show the equivalent of LoggerT and the monad decorated by WithLog. When I tried to learn about the colog library, I got confused why it provides a LoggerT but rarely uses it in the example. Instead, we use the WithLog more frequently.

I'm not sure whether I miss some haskell knowledges that leads the confusion, or colog misses some documentation about them. I prefer the latter, hence I created a PR for appending this detail.

@xieyuschen
Copy link
Member Author

@xieyuschen - one again, thanks for your contribution - I've changed a few small things - if you still like it, I think we should merge it 👍 otherwise feel free to further improve this PR 😉

sure, thanks for your kindly help. I will check it:)

@alaendle alaendle merged commit c6dd649 into co-log:main Mar 1, 2024
7 checks passed
@alaendle
Copy link
Member

alaendle commented Mar 1, 2024

I hope it was okay that I already merged - it's better to have a lot of small progress rather than being stuck 😃

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants