Skip to content

Provide the ability to log to STDERR #39

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

Merged
merged 2 commits into from
Aug 10, 2020

Conversation

weierophinney
Copy link
Member

This patch accomplishes the following:

  • It adds dependencies on psr/log and monolog/monolog.
  • It adds a new optional LOG_LEVEL env variable, defaulting to 'INFO'.
  • It updates bin/console.php to create a monolog Logger instance that composes a StreamHandler tied to the STDERR resource, and logging at the provided LOG_LEVEL.
  • It updates the ReleaseChangelogViaKeepAChangelog class to compose a psr/log LoggerInterface, and use it to log informative messages during its workflow.
  • It updates the bin/console.php script to inject the ReleaseChangelogViaKeepAChangelog instance with the configured Logger instance.

We likely will want even more logging; I've just provided the barebones of what we need, and an example of how to accomplish it.

Fixes #14

Adds psr/log and monolog/monolog as dependencies. Additionally, sets up
the environment and application to allow consuming a log.

The new `LOG_LEVEL` environment variable is optional, and will default
to `'INFO'`. In the `bin/console.php` file, we now create a Monolog
logger instance with a `StreamHandler` that writes to the `STDERR`
stream, using the configured `LOG_LEVEL`.

Signed-off-by: Matthew Weier O'Phinney <[email protected]>
This patch accomplishes the following:

- It ensures that the handling of env variables with default values is
  consistent with the type hints.
- It adds a constructor dependency on the psr/log `LoggerInterface` to
  `ReleaseChangelogViaKeepAChangelog`.
- It adds logging statements at key workflow points in that class, using
  the provided logger.
- It updates the `bin/console.php` script to provide the logger instance
  to the `ReleaseChangelogViaKeepAChangelog` instance.

Signed-off-by: Matthew Weier O'Phinney <[email protected]>
@weierophinney weierophinney added this to the 1.2.0 milestone Aug 10, 2020
@Ocramius Ocramius merged commit df4c610 into laminas:1.2.x Aug 10, 2020
@weierophinney weierophinney deleted the feature/logger branch August 10, 2020 21:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Increase STDERR verbosity of CLI commands
2 participants