Skip to content

Commit

Permalink
Quellcode aufgeräumt
Browse files Browse the repository at this point in the history
  • Loading branch information
Mirko Fenrich committed Jun 18, 2017
1 parent f6a48b5 commit a72e4c5
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 44 deletions.
5 changes: 0 additions & 5 deletions src/ConfigProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,6 @@

namespace Depa\MiddlewareLogger;






/**
* The configuration provider for the Core module
*
Expand Down
20 changes: 6 additions & 14 deletions src/LoggerFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@
use Interop\Container\ContainerInterface;
use Zend\ServiceManager\Factory\FactoryInterface;




class LoggerFactory implements FactoryInterface{
/**
* {@inheritDoc}
Expand All @@ -15,23 +12,18 @@ class LoggerFactory implements FactoryInterface{
public function __invoke(ContainerInterface $container,$requestedName, array $options = null)
{
$config = $container->get('config');
$loggerConfig = array_key_exists('logger', $config) ? $config['logger'] : [];

if (!isset($config['logger'])) {
// $sessionManager = new SessionManager();
// Container::setDefaultManager($sessionManager);
// return $sessionManager;
}

$logWriter = array_key_exists('writer', $loggerConfig) ? $loggerConfig['writer'] : 'Null';

//$PsrLogger = (new \Depa\MiddlewareLogger\Logger\NullLogger())->getLogger();
$PsrLogger = (new \Depa\MiddlewareLogger\Logger\ChromePhpLogger())->getLogger();
$logWriter = '\\Depa\\MiddlewareLogger\\Logger\\'.$logWriter.'Logger';

$PsrLogger = (new $logWriter())->getLogger();


$log = new Logger($PsrLogger);

return ($log);

}



}
15 changes: 0 additions & 15 deletions src/LoggerMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,6 @@
use Interop\Http\ServerMiddleware\MiddlewareInterface;
use Psr\Http\Message\ServerRequestInterface;






class LoggerMiddleware implements MiddlewareInterface
{
private $zendLogger;
Expand All @@ -24,17 +19,7 @@ public function __construct( $logger)
*/
public function process(ServerRequestInterface $request, DelegateInterface $delegate)
{
$this->zendLogger::alert("huuuuw");
$this->zendLogger::alert("bla");
//$this->zendLogger->alert(microtime());
//was loggen???
$response = $delegate->process($request);

//$this->zendLogger->notice(array(1,2,3));

//was loggen?
return $response;


}
}
13 changes: 3 additions & 10 deletions src/LoggerMiddlewareFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,12 @@

use Interop\Container\ContainerInterface;


class LoggerMiddlewareFactory
{

public function __invoke(ContainerInterface $container)
{
$logger = $container->get(Logger::class);


/* $logger = new \Zend\Log\Logger();
$logger->addWriter(new \Zend\Log\Writer\ChromePHP());
$PsrLogger = new \Zend\Log\PsrLoggerAdapter($logger); */


return new LoggerMiddleware($logger );
$logger = $container->get(Logger::class);
return new LoggerMiddleware($logger);
}
}

0 comments on commit a72e4c5

Please sign in to comment.