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.

@ioquatix @postmodern yes but I’m speaking fir long running daemons, not Unix style scripts.

@mperham @postmodern Why does it make any difference for long running daemons vs scripts? Is there some downside to putting all logging/diagnostics to `stderr`? In contrast, since `stdout` is buffered, there are downsides to using it for logging, e.g. missing output on crash.

Sign in to participate in the conversation
Ruby.social

A Mastodon instance for Rubyists & friends