credo icon indicating copy to clipboard operation
credo copied to clipboard

Add check for piping into Logger functions

Open hkrutzer opened this issue 11 months ago • 2 comments

Calls into Logger can be purged when :compile_time_purge_matching is enabled in the Logger configuration causing unexpected behavior in releases.

See https://x.com/elixirboy/status/1770336803280556486 and https://bsky.app/profile/hauleth.dev/post/3lhguoqmpos2i for examples of this happening to people.

hkrutzer avatar Mar 02 '25 20:03 hkrutzer

Hi, thx for putting this together.

But please don't link several social media posts on different networks (which not everybody might have an account for) instead of writing a simple rationale. 🙂

It is also bad for reviewers to come back to something like this and then having to open multiple tabs again, just to re-familiarize themselves. 👍

rrrene avatar Mar 03 '25 05:03 rrrene

Thanks @rrrene the description was not intended to be a rationale, but to argue the merit of the check. The rationale is in the description of the check. I understand if that wasn't clear. I added part of the check description to the PR description 👍

hkrutzer avatar Mar 03 '25 14:03 hkrutzer

Hi, thx again for this. Unfortunately, I am closing it as I really never got why this check should be included as a standard check in Credo (the 1-sentence-explanation did not make it any clearer).

If you disagree, please re-open and elaborate! :+1:

rrrene avatar Nov 11 '25 20:11 rrrene

Which single sentence are you referring to? The explanation I wrote is 3 sentences:

      Calls into Logger can be purged when `:compile_time_purge_matching` is enabled in
      the Logger configuration. This will remove the entire pipeline.
      Use |> tap(&Logger.info(&1)) instead.

hkrutzer avatar Nov 11 '25 20:11 hkrutzer