Skip to content

Added support for runtime options#7

Open
Niteshvgupta wants to merge 2 commits into
1.xfrom
feature/runtime-options
Open

Added support for runtime options#7
Niteshvgupta wants to merge 2 commits into
1.xfrom
feature/runtime-options

Conversation

@Niteshvgupta
Copy link
Copy Markdown

The purpose of this commit is to allow support for access to set and get run-time options. Extensions of Monolog, such as Cascade, will need to set a run-time options from a config file and access it after parsing and losing access to the config file.

Comment thread src/Monolog/Registry.php
* @return bool
*/
public static function hasOption($name)
{
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

It is safer to do array_key_exists($name, static::$options) in case someone sets a value as null for some reason. Also, when accessing static member variables and properties, prefer static:: to self::. The reason is that static supports late static binding whereas self does not.

@PhiloEpisteme
Copy link
Copy Markdown

Can you explain what the purpose of these run-time options is? One use case we need is to change behavior when we ask Cascade for a logger that does not exist. It feels like that work can be in Cascade and not in Monolog. For example, Cascade could ask the Monolog::Registry for a logger, if it doesn't exist, ask for the first parent, if it doesn't exist ask for the next parent etc until one is found.

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