Logs simplificados en dev

This commit is contained in:
Juan Pablo Vial
2025-03-26 11:37:16 -03:00
parent 61244f783a
commit 5740c0e47f

View File

@ -2,31 +2,41 @@
use Psr\Container\ContainerInterface; use Psr\Container\ContainerInterface;
return [ return [
Monolog\Formatter\LineFormatter::class => function(ContainerInterface $container) {
return (new Monolog\Formatter\LineFormatter(null, null, false, false, true))
->setBasePath('/code/');
},
Psr\Log\LoggerInterface::class => function(ContainerInterface $container) { Psr\Log\LoggerInterface::class => function(ContainerInterface $container) {
return new Monolog\Logger('incoviba', [ return new Monolog\Logger('incoviba', [
new Monolog\Handler\FilterHandler( new Monolog\Handler\FilterHandler(
(new Monolog\Handler\RotatingFileHandler('/logs/error.log', 10)) ($container->has('ENVIRONMENT') and $container->get('ENVIRONMENT') === 'development')
->setFormatter(new Monolog\Formatter\LineFormatter(null, null, false, false, true)), ? (new Monolog\Handler\StreamHandler('/logs/error.log'))
->setFormatter($container->get(Monolog\Formatter\LineFormatter::class))
: (new Monolog\Handler\RotatingFileHandler('/logs/error.log', 10))
->setFormatter($container->get(Monolog\Formatter\LineFormatter::class)),
Monolog\Level::Error, Monolog\Level::Error,
Monolog\Level::Error Monolog\Level::Error
), ),
new Monolog\Handler\FilterHandler( new Monolog\Handler\FilterHandler(
(new Monolog\Handler\RotatingFileHandler('/logs/critical.log', 10)) ($container->has('ENVIRONMENT') and $container->get('ENVIRONMENT') === 'development')
->setFormatter(new Monolog\Formatter\LineFormatter(null, null, false, false, true)), ? (new Monolog\Handler\StreamHandler('/logs/critical.log'))
->setFormatter($container->get(Monolog\Formatter\LineFormatter::class))
: (new Monolog\Handler\RotatingFileHandler('/logs/critical.log', 10))
->setFormatter($container->get(Monolog\Formatter\LineFormatter::class)),
Monolog\Level::Critical Monolog\Level::Critical
), ),
new Monolog\Handler\FilterHandler( new Monolog\Handler\FilterHandler(
($container->has('ENVIRONMENT') and $container->get('ENVIRONMENT') === 'development') ($container->has('ENVIRONMENT') and $container->get('ENVIRONMENT') === 'development')
? (new Monolog\Handler\RotatingFileHandler('/logs/debug.log', 10)) ? (new Monolog\Handler\StreamHandler('/logs/debug.log'))
->setFormatter(new Monolog\Formatter\LineFormatter(null, null, false, false, true)) ->setFormatter($container->get(Monolog\Formatter\LineFormatter::class))
: new Monolog\Handler\RedisHandler($container->get(Predis\ClientInterface::class), 'logs:notices'), : new Monolog\Handler\RedisHandler($container->get(Predis\ClientInterface::class), 'logs:notices'),
Monolog\Level::Debug, Monolog\Level::Debug,
Monolog\Level::Info Monolog\Level::Info
), ),
new Monolog\Handler\FilterHandler( new Monolog\Handler\FilterHandler(
($container->has('ENVIRONMENT') and $container->get('ENVIRONMENT') === 'development') ($container->has('ENVIRONMENT') and $container->get('ENVIRONMENT') === 'development')
? (new Monolog\Handler\RotatingFileHandler('/logs/notices.log', 10)) ? (new Monolog\Handler\StreamHandler('/logs/notices.log'))
->setFormatter(new Monolog\Formatter\LineFormatter(null, null, false, false, true)) ->setFormatter($container->get(Monolog\Formatter\LineFormatter::class))
: (new Incoviba\Common\Implement\Log\MySQLHandler($container->get(Incoviba\Common\Define\Connection::class))) : (new Incoviba\Common\Implement\Log\MySQLHandler($container->get(Incoviba\Common\Define\Connection::class)))
->setFormatter(new Incoviba\Common\Implement\Log\PDOFormatter()), ->setFormatter(new Incoviba\Common\Implement\Log\PDOFormatter()),
Monolog\Level::Notice, Monolog\Level::Notice,