Skip to content

Conversation

@viralpraxis
Copy link
Contributor

@viralpraxis viralpraxis commented Feb 12, 2025

Creating a logger automatically writes a hardcoded header comment ("# Logfile created on ...").
While this helps verify that logdev is writable as early as possible (rather than on the first log entry), it also serves as a useful indicator of which program created the logfile.

However, this header can introduce unnecessary
complexity -- especially when working with third-party tools that need to ignore these lines.

This commit introduces a skip_header boolean
option (default is false), allowing API consumers to disable the header if needed.

issue: https://bugs.ruby-lang.org/issues/21133

Copy link
Contributor

@jeremyevans jeremyevans left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not the logger maintainer, but I think this is a useful feature, and the implementation looks fine.

@viralpraxis viralpraxis force-pushed the add-skip-header-option branch from 561f3a2 to 7e2e9e3 Compare February 14, 2025 10:49
@viralpraxis viralpraxis changed the title Add skip_header option [Feature #21133] Add skip_header option Feb 14, 2025
ref: https://bugs.ruby-lang.org/issues/21133

Creating a logger automatically writes a hardcoded
header comment ("# Logfile created on ...").
While this helps verify that logdev is writable as
early as possible (rather than on the first log entry),
it also serves as a useful indicator of which program created
the logfile.

However, this header can introduce unnecessary
complexity -- especially when working with third-party
tools that need to ignore these lines.

This commit introduces a `skip_header` boolean
option (default is `false`), allowing API consumers
to disable the header if needed.
@viralpraxis viralpraxis force-pushed the add-skip-header-option branch from 7e2e9e3 to 552b075 Compare February 14, 2025 10:52
@hsbt hsbt merged commit 30a6070 into ruby:master Mar 11, 2025
31 checks passed
@viralpraxis viralpraxis deleted the add-skip-header-option branch March 11, 2025 19:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants