function GET() { /** * @todo this is overly complicated. The registration code should be * refactored and rethought. */ $logger = \Asar\Logger\Registry::getLogger($this); $logger->log('This is the first log.'); $logger->log('This is the second log.'); return 'Hello!'; }
function testUnsettingARegisteredLoggerRemovesInstancesOfItFromRegistry() { Registry::register('Namespace1', $this->log_file); $logger1 = Registry::getLogger('Namespace1'); Registry::unRegister('Namespace1'); Registry::register('Namespace1', $this->log_file); $logger2 = Registry::getLogger('Namespace1'); $this->assertNotSame($logger1, $logger2); }