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

Adds possibility to override MonologAdapter in config #19

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/Kdyby/Monolog/DI/MonologExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ class MonologExtension extends CompilerExtension
'hookToTracy' => TRUE,
'tracyBaseUrl' => NULL,
'usePriorityProcessor' => TRUE,
'adapter' => 'Kdyby\Monolog\Diagnostics\MonologAdapter',
// 'registerFallback' => TRUE,
];

Expand Down Expand Up @@ -75,7 +76,7 @@ public function loadConfiguration()

// Tracy adapter
$builder->addDefinition($this->prefix('adapter'))
->setClass('Kdyby\Monolog\Diagnostics\MonologAdapter', [$this->prefix('@logger')])
->setClass($config['adapter'], [$this->prefix('@logger')])
Copy link
Member

Choose a reason for hiding this comment

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

AFAIK you can already do this using services section of neon configuration, no?

->addTag('logger');

if ($builder->hasDefinition('tracy.logger')) { // since Nette 2.3
Expand Down
4 changes: 2 additions & 2 deletions src/Kdyby/Monolog/Diagnostics/MonologAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class MonologAdapter extends Logger
/**
* @var array
*/
private $priorityMap = [
protected $priorityMap = [
self::DEBUG => Monolog\Logger::DEBUG,
self::INFO => Monolog\Logger::INFO,
self::WARNING => Monolog\Logger::WARNING,
Expand All @@ -41,7 +41,7 @@ class MonologAdapter extends Logger
/**
* @var Monolog\Logger
*/
private $monolog;
protected $monolog;
Copy link
Member

Choose a reason for hiding this comment

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

this is not needed, since you can catch the constuctor argument in the inherited class




Expand Down