Skip to content

Sentry Structured Logging for PHP #1824

Open
@cleptric

Description

@cleptric

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

Sentry is adding support for structured logging. Let's add it to the PHP 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.
  6. Create a GH discussion that contains instructions for setting up the SDK in your repo. Eventually this will be moved into the primary docs. See the JS SDK's GH discussion for inspiration.

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

Metadata

Metadata

Assignees

Type

No type

Projects

Status

No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions