Removed unused LogHandlerType

This commit is contained in:
netkas 2024-10-28 19:37:51 -04:00
parent 15f55b870d
commit 8f9333a273
4 changed files with 0 additions and 50 deletions

View file

@ -1,9 +0,0 @@
<?php
namespace LogLib\Enums;
enum LogHandlerType : string
{
case CONSOLE = 'console';
case FILE = 'file';
}

View file

@ -6,7 +6,6 @@ use Exception;
use LogLib\Classes\Utilities;
use LogLib\Classes\Validate;
use LogLib\Enums\ConsoleColors;
use LogLib\Enums\LogHandlerType;
use LogLib\Enums\LogLevel;
use LogLib\Exceptions\LoggingException;
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
*

View file

@ -5,7 +5,6 @@ namespace LogLib\Handlers;
use LogLib\Classes\FileLock;
use LogLib\Classes\Utilities;
use LogLib\Classes\Validate;
use LogLib\Enums\LogHandlerType;
use LogLib\Enums\LogLevel;
use LogLib\Exceptions\LoggingException;
use LogLib\Interfaces\LogHandlerInterface;
@ -59,11 +58,6 @@ class FileLogging implements LogHandlerInterface
self::getLogger($application)->append($output);
}
public static function getType(): LogHandlerType
{
return LogHandlerType::FILE;
}
private static function getLogger(Application $application): FileLock
{
if(!isset(self::$application_logs[$application->getApplicationName()]))
@ -98,23 +92,6 @@ class FileLogging implements LogHandlerInterface
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
{
return date('yd/m/y H:i');

View file

@ -2,11 +2,9 @@
namespace LogLib\Interfaces;
use LogLib\Enums\LogHandlerType;
use LogLib\Exceptions\LoggingException;
use LogLib\Objects\Application;
use LogLib\Objects\Event;
use LogLib\Objects\Options;
interface LogHandlerInterface
{
@ -19,11 +17,4 @@ interface LogHandlerInterface
* @throws LoggingException If an error occurs while handling the event
*/
public static function handle(Application $application, Event $event): void;
/**
* Returns the type of log handler.
*
* @return LogHandlerType
*/
public static function getType(): LogHandlerType;
}