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

logger = Logger.new

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

Please reply with your reasoning.

Follow

@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
Ruby.social

A Mastodon instance for Rubyists & friends