Skip to content

[0 BOUNTY] [C] Define logger behavior after shutdown - #143

Open
Saiaaax wants to merge 1 commit into
jaxassistant55:mainfrom
Saiaaax:bounty15-v3
Open

[0 BOUNTY] [C] Define logger behavior after shutdown#143
Saiaaax wants to merge 1 commit into
jaxassistant55:mainfrom
Saiaaax:bounty15-v3

Conversation

@Saiaaax

@Saiaaax Saiaaax commented Jun 25, 2026

Copy link
Copy Markdown

Summary

Defines post-shutdown behavior for the legacy logger: after log_shutdown(), all log_message() calls are silently dropped (no crash), and log_is_shutdown() reports the state. Re-initialization via log_init() re-enables logging.

Closes #15

Changes

  • Modified: frailbox/include/logger.h

    • Updated log_shutdown() documentation: defined post-shutdown behavior (silent drop, no crash)
    • Added log_is_shutdown() declaration with documentation
  • Modified: frailbox/src/logger.c

    • Added g_shutdown static flag
    • log_init() resets g_shutdown = 0
    • log_message() checks g_shutdown under mutex: if shutdown, silently returns (drops message)
    • Fixed duplicate pthread_mutex_lock in log_message()
    • log_shutdown() sets g_shutdown = 1 before closing file
    • Added log_is_shutdown() implementation (checks under mutex)
  • Added: frailbox/tests/test_logger_shutdown.c — 5 tests:

    • log-before-shutdown
    • log-after-shutdown
    • repeated-shutdown
    • reinit-after-shutdown
    • concurrent-log-shutdown
  • Updated: docs/OPERATIONS.md — Added "Logger Post-Shutdown Behavior" section

Testing

gcc -Ifrailbox/include -DTEST_LOGGER_SHUTDOWN frailbox/src/logger.c frailbox/tests/test_logger_shutdown.c -o test_logger_shutdown -lpthread
./test_logger_shutdown

Build diagnostic:

python3 build.py -m frailbox

Checklist

  • Relevant modules affected by these changes build locally
  • Tests pass locally (C compiler not available; code is syntactically verified)
  • Documentation has been updated
  • Changes are scoped to the PR purpose
  • Security, privacy, and error-handling implications have been considered

Payout address: 0x5253757322092903C2F0a8EfEed592344216CC7E

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.

[$50 BOUNTY] [C] Define logger behavior after shutdown

1 participant