Writing Logs to Slack, Sheets, and Console: Dedicated Service or Implementation of Logger?
hi all, trying to effectify a production codebase as i learn.
we have some interesting use-cases for logging. sometimes we log to a slack channel (user feedback, contact form, critical issues) to ping the team directly. sometimes we log to Google Sheets for ease of access for BI team.
what's the most idiomatic way of representing this? various implementations of
Logger
Logger
like
SlackLogger
SlackLogger
and
SheetsLogger
SheetsLogger
? since each of these need to route to a specific channel or sheet, would i create some factory method like
createSlackLoggerLayer(channelId: string): Logger
createSlackLoggerLayer(channelId: string): Logger
?
alternatively i could just have separate services for Slack and Sheets - although i like the simplification that everything is just a "Logger" than can we swapped. let me know!