Move factory classes to a subfolder
This commit is contained in:
parent
123a6c5ad9
commit
0a220d4d8e
9 changed files with 21 additions and 17 deletions
35
classes/Factory/LoggerFactory.php
Normal file
35
classes/Factory/LoggerFactory.php
Normal file
|
@ -0,0 +1,35 @@
|
|||
<?php
|
||||
|
||||
namespace Alltube\Factory;
|
||||
|
||||
use Consolidation\Log\Logger;
|
||||
use Consolidation\Log\LogOutputStyler;
|
||||
use Slim\Container;
|
||||
use Symfony\Component\Console\Output\ConsoleOutput;
|
||||
|
||||
/**
|
||||
* Class LoggerFactory
|
||||
* @package Alltube
|
||||
*/
|
||||
class LoggerFactory
|
||||
{
|
||||
|
||||
/**
|
||||
* @param Container $container
|
||||
* @return Logger
|
||||
*/
|
||||
public static function create(Container $container)
|
||||
{
|
||||
$config = $container->get('config');
|
||||
if ($config->debug) {
|
||||
$verbosity = ConsoleOutput::VERBOSITY_DEBUG;
|
||||
} else {
|
||||
$verbosity = ConsoleOutput::VERBOSITY_NORMAL;
|
||||
}
|
||||
|
||||
$logger = new Logger(new ConsoleOutput($verbosity));
|
||||
$logger->setLogOutputStyler(new LogOutputStyler());
|
||||
|
||||
return $logger;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue