Skip to content

Conversation

@justin-layerv
Copy link
Contributor

Summary

Add error handling for file.Sync() and file.Close() operations in the async log writer.

Problem

The writeRoutine() function in AsyncLogWriter was not checking errors from:

  • file.Sync() - could fail if disk is full or I/O error occurs
  • file.Close() - could indicate buffered writes didn't flush properly

According to Go best practices, errors from closing writable files should be checked as they can indicate data loss.

Changes

File Change
nhp/log/logger.go Add error handling for file.Sync() and file.Close()

Test plan

  • Verify build passes
  • Verify logging still works correctly
  • Error messages are printed when sync/close fails (e.g., disk full scenario)

🤖 Generated with Claude Code

@justin-layerv justin-layerv self-assigned this Jan 3, 2026
@craftleon craftleon force-pushed the fix/logger-file-close-error-handling branch from a0f8d69 to 5819cb9 Compare January 6, 2026 08:03
craftleon
craftleon previously approved these changes Jan 6, 2026
@craftleon
Copy link
Contributor

Merging is blocked due to commit missing verified signatures

@justin-layerv justin-layerv force-pushed the fix/logger-file-close-error-handling branch from 5819cb9 to 2770696 Compare January 6, 2026 22:32
@justin-layerv justin-layerv merged commit 072594a into OpenNHP:main Jan 6, 2026
7 checks passed
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.

2 participants