Removed unused LogHandlerType
This commit is contained in:
parent
15f55b870d
commit
8f9333a273
4 changed files with 0 additions and 50 deletions
|
@ -1,9 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace LogLib\Enums;
|
|
||||||
|
|
||||||
enum LogHandlerType : string
|
|
||||||
{
|
|
||||||
case CONSOLE = 'console';
|
|
||||||
case FILE = 'file';
|
|
||||||
}
|
|
|
@ -6,7 +6,6 @@ use Exception;
|
||||||
use LogLib\Classes\Utilities;
|
use LogLib\Classes\Utilities;
|
||||||
use LogLib\Classes\Validate;
|
use LogLib\Classes\Validate;
|
||||||
use LogLib\Enums\ConsoleColors;
|
use LogLib\Enums\ConsoleColors;
|
||||||
use LogLib\Enums\LogHandlerType;
|
|
||||||
use LogLib\Enums\LogLevel;
|
use LogLib\Enums\LogLevel;
|
||||||
use LogLib\Exceptions\LoggingException;
|
use LogLib\Exceptions\LoggingException;
|
||||||
use LogLib\Interfaces\LogHandlerInterface;
|
use LogLib\Interfaces\LogHandlerInterface;
|
||||||
|
@ -73,14 +72,6 @@ class ConsoleLogging implements LogHandlerInterface
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @inheritDoc
|
|
||||||
*/
|
|
||||||
public static function getType(): LogHandlerType
|
|
||||||
{
|
|
||||||
return LogHandlerType::CONSOLE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Formats the application name with a color for the console
|
* Formats the application name with a color for the console
|
||||||
*
|
*
|
||||||
|
|
|
@ -5,7 +5,6 @@ namespace LogLib\Handlers;
|
||||||
use LogLib\Classes\FileLock;
|
use LogLib\Classes\FileLock;
|
||||||
use LogLib\Classes\Utilities;
|
use LogLib\Classes\Utilities;
|
||||||
use LogLib\Classes\Validate;
|
use LogLib\Classes\Validate;
|
||||||
use LogLib\Enums\LogHandlerType;
|
|
||||||
use LogLib\Enums\LogLevel;
|
use LogLib\Enums\LogLevel;
|
||||||
use LogLib\Exceptions\LoggingException;
|
use LogLib\Exceptions\LoggingException;
|
||||||
use LogLib\Interfaces\LogHandlerInterface;
|
use LogLib\Interfaces\LogHandlerInterface;
|
||||||
|
@ -59,11 +58,6 @@ class FileLogging implements LogHandlerInterface
|
||||||
self::getLogger($application)->append($output);
|
self::getLogger($application)->append($output);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getType(): LogHandlerType
|
|
||||||
{
|
|
||||||
return LogHandlerType::FILE;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static function getLogger(Application $application): FileLock
|
private static function getLogger(Application $application): FileLock
|
||||||
{
|
{
|
||||||
if(!isset(self::$application_logs[$application->getApplicationName()]))
|
if(!isset(self::$application_logs[$application->getApplicationName()]))
|
||||||
|
@ -98,23 +92,6 @@ class FileLogging implements LogHandlerInterface
|
||||||
return $logging_file;
|
return $logging_file;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static function getExceptionFile(Application $application, \Throwable $e): string
|
|
||||||
{
|
|
||||||
$logging_directory = $application->getFileLoggingDirectory();
|
|
||||||
|
|
||||||
if(!is_writable($logging_directory))
|
|
||||||
{
|
|
||||||
throw new LoggingException(sprintf("Cannot write to %s due to insufficient permissions", $logging_directory));
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!file_exists($logging_directory))
|
|
||||||
{
|
|
||||||
mkdir($logging_directory);
|
|
||||||
}
|
|
||||||
|
|
||||||
return Utilities::sanitizeFileName($application->getApplicationName()) . '-' . Utilities::sanitizeFileName(get_class($e)) . '-' . date('d-m-Y-H-i-s') . '.json';
|
|
||||||
}
|
|
||||||
|
|
||||||
private static function getTimestamp(): string
|
private static function getTimestamp(): string
|
||||||
{
|
{
|
||||||
return date('yd/m/y H:i');
|
return date('yd/m/y H:i');
|
||||||
|
|
|
@ -2,11 +2,9 @@
|
||||||
|
|
||||||
namespace LogLib\Interfaces;
|
namespace LogLib\Interfaces;
|
||||||
|
|
||||||
use LogLib\Enums\LogHandlerType;
|
|
||||||
use LogLib\Exceptions\LoggingException;
|
use LogLib\Exceptions\LoggingException;
|
||||||
use LogLib\Objects\Application;
|
use LogLib\Objects\Application;
|
||||||
use LogLib\Objects\Event;
|
use LogLib\Objects\Event;
|
||||||
use LogLib\Objects\Options;
|
|
||||||
|
|
||||||
interface LogHandlerInterface
|
interface LogHandlerInterface
|
||||||
{
|
{
|
||||||
|
@ -19,11 +17,4 @@ interface LogHandlerInterface
|
||||||
* @throws LoggingException If an error occurs while handling the event
|
* @throws LoggingException If an error occurs while handling the event
|
||||||
*/
|
*/
|
||||||
public static function handle(Application $application, Event $event): void;
|
public static function handle(Application $application, Event $event): void;
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the type of log handler.
|
|
||||||
*
|
|
||||||
* @return LogHandlerType
|
|
||||||
*/
|
|
||||||
public static function getType(): LogHandlerType;
|
|
||||||
}
|
}
|
Loading…
Add table
Reference in a new issue