-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
106 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,13 @@ | ||
# Version 16.6.0 | ||
|
||
## Bugfixes | ||
|
||
* None | ||
|
||
## Features | ||
|
||
* Add techdivision/import#191 | ||
|
||
# Version 16.5.5 | ||
|
||
## Bugfixes | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
<?php | ||
|
||
/** | ||
* TechDivision\Import\Loggers\ErrorLogHandlerFactory | ||
* | ||
* NOTICE OF LICENSE | ||
* | ||
* This source file is subject to the Open Software License (OSL 3.0) | ||
* that is available through the world-wide-web at this URL: | ||
* http://opensource.org/licenses/osl-3.0.php | ||
* | ||
* PHP version 5 | ||
* | ||
* @author Martin Eisenführer <[email protected]> | ||
* @copyright 2020 TechDivision GmbH <[email protected]> | ||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) | ||
* @link https://github.com/techdivision/import | ||
* @link http://www.techdivision.com | ||
*/ | ||
|
||
namespace TechDivision\Import\Loggers; | ||
|
||
use TechDivision\Import\Utils\ConfigurationUtil; | ||
use TechDivision\Import\Utils\ConfigurationKeys; | ||
use TechDivision\Import\Configuration\ConfigurationInterface; | ||
use TechDivision\Import\Configuration\Logger\HandlerConfigurationInterface; | ||
|
||
/** | ||
* Error Log Handler factory implementation. | ||
* | ||
* @author Martin Eisenführer <[email protected]> | ||
* @copyright 2020 TechDivision GmbH <[email protected]> | ||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) | ||
* @link https://github.com/techdivision/import | ||
* @link http://www.techdivision.com | ||
*/ | ||
class GenericLogHandlerFactory implements HandlerFactoryInterface | ||
{ | ||
|
||
/** | ||
* The log level to use. | ||
* | ||
* @var string | ||
*/ | ||
protected $defaultLogLevel; | ||
|
||
/** | ||
* The log level to use. | ||
* | ||
* @var string | ||
*/ | ||
protected $handlerClassName; | ||
|
||
/** | ||
* Initialize the processor with the actual configuration instance | ||
* | ||
* @param ConfigurationInterface $configuration the actual configuration instance | ||
* @param string $handlerClassName Classname for monolog Logger handler | ||
*/ | ||
public function __construct(ConfigurationInterface $configuration, $handlerClassName) | ||
{ | ||
$this->defaultLogLevel = $configuration->getLogLevel(); | ||
$this->handlerClassName = $handlerClassName; | ||
} | ||
|
||
/** | ||
* Creates a new formatter instance based on the passed configuration. | ||
* | ||
* @param \TechDivision\Import\Configuration\Logger\HandlerConfigurationInterface $handlerConfiguration The handler configuration | ||
* | ||
* @return \Monolog\Handler\HandlerInterface The handler instance | ||
*/ | ||
public function factory(HandlerConfigurationInterface $handlerConfiguration) | ||
{ | ||
|
||
// load the params | ||
$params = $handlerConfiguration->getParams(); | ||
|
||
// set the default log level, if not already set explicitly | ||
if (!isset($params[ConfigurationKeys::LEVEL])) { | ||
$params[ConfigurationKeys::LEVEL] = $this->defaultLogLevel; | ||
} | ||
|
||
// create and return the handler instance | ||
$reflectionClass = new \ReflectionClass($this->handlerClassName); | ||
return $reflectionClass->newInstanceArgs(ConfigurationUtil::prepareConstructorArgs($reflectionClass, $params)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters