initial commit

This commit is contained in:
Milos Stojanovic
2019-06-13 18:52:40 +02:00
commit 261607e1d3
160 changed files with 41704 additions and 0 deletions

View File

@@ -0,0 +1,39 @@
<?php
/*
* This file is part of the FileGator package.
*
* (c) Milos Stojanovic <alcalbg@gmail.com>
*
* For the full copyright and license information, please view the LICENSE file
*/
namespace Filegator\Services\Logger\Adapters;
use Filegator\Services\Logger\LoggerInterface;
use Filegator\Services\Service;
use Monolog\ErrorHandler;
use Monolog\Logger;
class MonoLogger implements Service, LoggerInterface
{
protected $logger;
public function init(array $config = [])
{
$this->logger = new Logger('default');
foreach ($config['monolog_handlers'] as $handler) {
$this->logger->pushHandler($handler());
}
$handler = new ErrorHandler($this->logger);
$handler->registerErrorHandler([], true);
$handler->registerFatalHandler();
}
public function log(string $message, string $level = Logger::INFO)
{
$this->logger->log($level, $message);
}
}

View File

@@ -0,0 +1,16 @@
<?php
/*
* This file is part of the FileGator package.
*
* (c) Milos Stojanovic <alcalbg@gmail.com>
*
* For the full copyright and license information, please view the LICENSE file
*/
namespace Filegator\Services\Logger;
interface LoggerInterface
{
public function log(string $message, string $level);
}