Skip to content
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

Full status compatibility with Datadog #2

Merged
merged 1 commit into from
Apr 6, 2023

Conversation

BernhardK91
Copy link
Collaborator

@BernhardK91 BernhardK91 commented Apr 6, 2023

This PR add full status (log level) compatibility in Datadog.

Also the required PHP version was bumped to 8.1 because monolog requires PHP 8.1 since version 3.0.0.

While refactoring the DatadogFormatter for compatibility with monolog, all custom changes became obsolet and the custom formatter was not needed anymore.

I have tested the changes in a Laravel application and it works fine:

image


if (isset($normalized['context']) && $normalized['context'] === []) {
$normalized['context'] = new stdClass;
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LogRecord does not have a writable context property. The context is set on creating the LogRecord object. Converting the empty array to an empty stdClass object is not needed anymore.


if (isset($normalized['extra']) && $normalized['extra'] === []) {
$normalized['extra'] = new stdClass;
}
Copy link
Collaborator Author

@BernhardK91 BernhardK91 Apr 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Converting the empty array to an empty stdClass object is not needed anymore.

Level::Debug, Level::Info => 'info',
Level::Notice, Level::Warning => 'warning',
Level::Error, Level::Alert, Level::Critical, Level::Emergency => 'error',
};
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no status attribute in the LogRecord object. Instead, we update the formatted string in DatadogHandler.

@sgoettsch sgoettsch merged commit d4b9be1 into sgoettsch:master Apr 6, 2023
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