Maintenance - We're currently working on things and you might experience some issues. Should be wrapped up soon!

This post has been de-listed

It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.

9
How to "pass around" the writer/logger?
Post Flair (click to view more posts with a particular flair)
Post Body

Setting aside the general "don't use writer monad for logging" advice I see, how do people usually handle this?

If you use it for logging, do people typically have a global writer that gets passed around (via reader monad/dependency injection) so everything can log the same way with just one configuration, or do modules usually define their own that is used just there, or what?

As practice I wanted to take the enterprise code I've been working on in Java and try to make it more functional in a different language in my free time. As is most Java enterprise code, each class has a private LOG property that gets used inside that class to do logging, so each class defines its own logger.

So it just got me thinking about how people like to do this kind of thing in more functional code. (As part of the official project, some of the Java has been replaced by TypeScript and I've written that functional, but the logging is still just console logging and very sparse. I wonder how I might improve this part since console logging in JS/TS is synchronous and thus blocking)

Author
Account Strength
100%
Account Age
13 years
Verified Email
Yes
Verified Flair
No
Total Karma
331,393
Link Karma
4,700
Comment Karma
325,520
Profile updated: 2 days ago
Posts updated: 1 month ago

Subreddit

Post Details

We try to extract some basic information from the post title. This is not always successful or accurate, please use your best judgement and compare these values to the post title and body for confirmation.
Posted
2 years ago