Skip to content

Add structured exception logging - #25

Merged
rtcoder merged 1 commit into
masterfrom
release/v0.18.0
Jun 17, 2026
Merged

Add structured exception logging#25
rtcoder merged 1 commit into
masterfrom
release/v0.18.0

Conversation

@rtcoder

@rtcoder rtcoder commented Jun 17, 2026

Copy link
Copy Markdown
Owner

Summary

  • add a zero-dependency logging layer with LoggerInterface, NullLogger, JsonFileLogger, and LoggerFactory
  • log framework exceptions from App and the global ErrorHandler with structured context
  • include request method, path, IP, user agent, request id, status, file, and line in exception log context
  • support LOG_ENABLED and LOG_PATH environment configuration
  • allow replacing the logger through the service container
  • document logging in README, developer docs, .env.example, and refactoring notes

Tests

  • composer validate --no-check-publish
  • find src application tests -name '*.php' -print0 | xargs -0 -n1 php -l
  • composer test
  • LOG_ENABLED=true LOG_PATH=/private/tmp/shift-log-smoke.log php -r 'require "bootstrap.php"; (Shift\Logging\LoggerFactory::fromEnv())->log("info", "smoke", ["ok" => true]); echo is_file("/private/tmp/shift-log-smoke.log") ? "log ok\n" : "missing\n";'

@rtcoder rtcoder added the v0.18.0 Release v0.18.0 label Jun 17, 2026
@rtcoder
rtcoder merged commit 68656e7 into master Jun 17, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

v0.18.0 Release v0.18.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant