Skip to content

fix: remove dead setlogsock call and expand Log.pm test coverage#70

Draft
toddr-bot wants to merge 1 commit into
mainfrom
koan.toddr.bot/cleanup-log-setlogsock
Draft

fix: remove dead setlogsock call and expand Log.pm test coverage#70
toddr-bot wants to merge 1 commit into
mainfrom
koan.toddr.bot/cleanup-log-setlogsock

Conversation

@toddr-bot
Copy link
Copy Markdown

@toddr-bot toddr-bot commented May 25, 2026

What

Remove dead setlogsock('unix') call from Log.pm and add tests for previously
untested Log utility methods.

Why

Sys::Syslog::setlogsock('unix') has been a no-op since Sys::Syslog 0.15 (2006).
The cpanfile requires >= 0.29, making the entire conditional block (OS checks,
_PATH_LOG() probe, setlogsock() call) pure dead code. Meanwhile, Debug(),
Error(), Fatal(), LogTime(), sprintf formatting, and class method invocation
had zero test coverage.

How

  • Removed the 5-line conditional block in OpenLog() (lines 78-82)
  • Added 10 new tests to t/logfile.t covering all untested Log.pm methods

Testing

Full test suite passes (86 subtests across 18 files). New tests verify:

  • Debug() suppression when debug flag is false, logging when true
  • Error() logs at err level
  • Fatal() logs and throws exception with formatted message
  • Log() sprintf-style argument formatting
  • LogTime() returns valid timestamp
  • Log() as class method writes to STDERR

🤖 Generated with Claude Code


Quality Report

Changes: 2 files changed, 93 insertions(+), 6 deletions(-)

Code scan: clean

Tests: passed (OK)

Branch hygiene: clean

Generated by Kōan post-mission quality pipeline

setlogsock('unix') has been a no-op since Sys::Syslog 0.15 (2006) and
the cpanfile already requires >= 0.29. Remove the entire conditional
block that checked _PATH_LOG() and called setlogsock().

Add 10 tests covering Debug(), Error(), Fatal(), LogTime(), sprintf
formatting, and class method invocation — none of which had coverage.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.

1 participant