PMCORE-1288
This commit is contained in:
committed by
Andrea Adamczyk
parent
e5f455fff3
commit
f6dfa7b25e
@@ -241,6 +241,7 @@ class MonologProvider
|
||||
*/
|
||||
public function setStream($fileLog)
|
||||
{
|
||||
// ONLY initialize a new RotatingFileHandler if the fileLog is DIFFERENT.
|
||||
//Set Routating Handler
|
||||
$this->streamRoutating = new RotatingFileHandler($this->getPathFile() . $fileLog,
|
||||
$this->getMaxFiles(),
|
||||
@@ -446,7 +447,6 @@ class MonologProvider
|
||||
{
|
||||
if (self::$instance === null) {
|
||||
self::$instance = new MonologProvider($channel, $fileLog, $readLoggingLevel);
|
||||
} else {
|
||||
self::$instance->setConfig($channel, $fileLog, $readLoggingLevel);
|
||||
}
|
||||
return self::$instance;
|
||||
@@ -489,4 +489,12 @@ class MonologProvider
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the instance property
|
||||
*/
|
||||
static function setInstance($instance)
|
||||
{
|
||||
self::$instance = $instance;
|
||||
}
|
||||
}
|
||||
@@ -213,4 +213,35 @@ class MonologProviderTest extends TestCase
|
||||
// Check that the CRITICAL was registered
|
||||
$this->assertTrue($res);
|
||||
}
|
||||
|
||||
/**
|
||||
* It tests the getSingleton method
|
||||
*
|
||||
* @covers ::getSingleton
|
||||
* @test
|
||||
*/
|
||||
public function it_test_the_get_singleton_method()
|
||||
{
|
||||
// Call the getSingleton method twice
|
||||
$log = MonologProvider::getSingleton('Channel Test', 'processmaker.log', true);
|
||||
$log = MonologProvider::getSingleton('Channel Test', 'processmaker.log', true);
|
||||
MonologProvider::setInstance("something");
|
||||
// Set level debug to "INFO"
|
||||
$log->setLevelDebug('INFO');
|
||||
// This asserts the lever debug is 200
|
||||
$this->assertEquals($log->getLevelDebug(), 200);
|
||||
// Set level debug to "UNDEFINED"
|
||||
$log->setLevelDebug('UNDEFINED');
|
||||
// This asserts there is no level debug
|
||||
$this->assertEmpty($log->getLevelDebug());
|
||||
}
|
||||
|
||||
/**
|
||||
* It calls the tearDown method
|
||||
*/
|
||||
public function tearDown()
|
||||
{
|
||||
parent::tearDown();
|
||||
MonologProvider::setInstance(null);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user