In the following Ruby code, should logger default to `$stderr` or `$stdout`?

logger =

CSV do |csv| "Generating row..."
csv << ['1', '2', '3']

Please reply with your reasoning.


@ioquatix There's a good explanation why it should go to stderr in "A Research UNIX Reader: Annotated Excerpts from the Programmer’s Manual":

@phil_pirozhkov I personally agree it should go to `stderr`. `stdout` is for normal program output, `stderr` is for everything else. Logging is not, by definition, normal program output, but a sequence of events that occurred in the program, and is typically used for debugging and diagnosing issues with the program.

Sign in to participate in the conversation

A Mastodon instance for Rubyists & friends