-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Need way to specify in the logger configuration the factory for the own writer #4455
Conversation
You're right; it's not possible yet. The logger service factories we have currently always instantiate a logger instance directly, and do not inject the writer or processor plugins, which means you can only use defaults currently. Scheduling for 2.3.0, as we will need to add the writer and processor plugin managers to the service manager first, and then alter the existing factories to use them. As such, we will have new functionality, which is reserved for new minor versions. |
I understood, thanks for the clarification |
Is this still something we need to keep open? |
- Allows passing the WriterPluginManager to the Logger constructor. - Adaptes the LoggerAbstractServiceFactory to inject the WriterPluginManager into the configuration prior to instantiating the logger.
- Allows passing the ProcessorPluginManager to the Logger constructor - Adaptes the LoggerAbstractServiceFactory to inject the ProcessorPluginManager into the configuration prior to instantiating the logger.
- LogWriterManager and LogProcessorManager services. - Wired into base service manager configuration, as well as ModuleManager feature provider system.
- Use LogWriterManager and LogProcessorManager services instead. - Added group annotations to tests
- trailing whitespace
@@ -140,6 +141,20 @@ public function __construct($options = null) | |||
throw new Exception\InvalidArgumentException('Options must be an array or an object implementing \Traversable '); | |||
} | |||
|
|||
// Inject writer plugin manager, if available | |||
if (isset($options['writer_plugin_manager']) | |||
&& $options['writer_plugin_manager'] instanceof AbstractPluginManager |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why AbstractPluginManager
and not just ServiceLocatorInterface
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is how we've typically written these, as it allows you to assume in your factories that you need to get the parent service locator instance if you need to get at app-level services.
This PR also requires a rebase |
- Allows passing the WriterPluginManager to the Logger constructor. - Adaptes the LoggerAbstractServiceFactory to inject the WriterPluginManager into the configuration prior to instantiating the logger.
- Allows passing the ProcessorPluginManager to the Logger constructor - Adaptes the LoggerAbstractServiceFactory to inject the ProcessorPluginManager into the configuration prior to instantiating the logger.
- LogWriterManager and LogProcessorManager services. - Wired into base service manager configuration, as well as ModuleManager feature provider system.
- Use LogWriterManager and LogProcessorManager services instead. - Added group annotations to tests
- trailing whitespace
…steners - LogWriterManager and LogProcessorManager services. - Wired into base service manager configuration, as well as ModuleManager feature provider system.
…-writer-and-processor-config' into develop Close zendframework/zendframework#4455
…to logger - Allows passing the WriterPluginManager to the Logger constructor. - Adaptes the LoggerAbstractServiceFactory to inject the WriterPluginManager into the configuration prior to instantiating the logger.
…er to logger - Allows passing the ProcessorPluginManager to the Logger constructor - Adaptes the LoggerAbstractServiceFactory to inject the ProcessorPluginManager into the configuration prior to instantiating the logger.
… reflect MVC - Use LogWriterManager and LogProcessorManager services instead. - Added group annotations to tests
- trailing whitespace
…-writer-and-processor-config' into develop Close zendframework/zendframework#4455
I want add to a logger my own writer who created by factory and I cann`t find any way for do this.
Here is the link to the stackoverflow, where I asked whether it is possible do that http://stackoverflow.com/questions/16414926/is-there-a-way-to-add-a-log-writer-factory-into-the-logger-configuration