Skip to content

Sentry Structured Logging for PHP #1824

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
cleptric opened this issue Apr 16, 2025 · 1 comment
Open

Sentry Structured Logging for PHP #1824

cleptric opened this issue Apr 16, 2025 · 1 comment
Assignees

Comments

@cleptric
Copy link
Member

cleptric commented Apr 16, 2025

https://develop.sentry.dev/sdk/telemetry/logs/

Sentry is adding support for structured logging. Let's add it to the Native SDKs!

  1. Define the logs protocol and log envelope item in the SDK
  2. Add the Public API (SDK options and methods) as per the docs
  3. Make sure the the SDK follows the documented behavior
  4. Attach default attributes to the SDK as per docs
  5. Instrument popular logging libraries to send logs to Sentry. SDK maintainers can best decide what they should support, but we should definitely support the same integrations that we do in the SDK today.

Logs can be emitted with one of the six available log levels, trace, debug, info, warn, error and fatal.

Usage without the agent looks as follows:

logger()->info('Hello, PHP!');
logger()->flush();

With the agent, users can omit the manual flush call:

logger()->info('Hello, PHP!');

WIP PR #1813

@giggsey
Copy link

giggsey commented Apr 22, 2025

Could this support PSR-3?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Waiting for: Product Owner
Development

No branches or pull requests

3 participants