From dec96d85e15b6b0304c216b3ec7d250c7d967174 Mon Sep 17 00:00:00 2001
From: netkas <netkas@n64.cc>
Date: Mon, 28 Oct 2024 15:29:46 -0400
Subject: [PATCH] Add LogHandlerInterface and related types

---
 src/LogLib/Enums/LogHandlerType.php           |  9 ++++++
 src/LogLib/Exceptions/LoggingException.php    | 13 +++++++++
 src/LogLib/Interfaces/LogHandlerInterface.php | 29 +++++++++++++++++++
 3 files changed, 51 insertions(+)
 create mode 100644 src/LogLib/Enums/LogHandlerType.php
 create mode 100644 src/LogLib/Exceptions/LoggingException.php
 create mode 100644 src/LogLib/Interfaces/LogHandlerInterface.php

diff --git a/src/LogLib/Enums/LogHandlerType.php b/src/LogLib/Enums/LogHandlerType.php
new file mode 100644
index 0000000..ad21d81
--- /dev/null
+++ b/src/LogLib/Enums/LogHandlerType.php
@@ -0,0 +1,9 @@
+<?php
+
+namespace LogLib\Enums;
+
+enum LogHandlerType : string
+{
+    case CONSOLE = 'console';
+    case FILE = 'file';
+}
diff --git a/src/LogLib/Exceptions/LoggingException.php b/src/LogLib/Exceptions/LoggingException.php
new file mode 100644
index 0000000..ad0bf19
--- /dev/null
+++ b/src/LogLib/Exceptions/LoggingException.php
@@ -0,0 +1,13 @@
+<?php
+
+namespace LogLib\Exceptions;
+
+use Exception;
+
+class LoggingException extends Exception
+{
+    public function __construct(string $message='', int $code=0, Exception $previous=null)
+    {
+        parent::__construct($message, $code, $previous);
+    }
+}
\ No newline at end of file
diff --git a/src/LogLib/Interfaces/LogHandlerInterface.php b/src/LogLib/Interfaces/LogHandlerInterface.php
new file mode 100644
index 0000000..1df12b4
--- /dev/null
+++ b/src/LogLib/Interfaces/LogHandlerInterface.php
@@ -0,0 +1,29 @@
+<?php
+
+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
+{
+    /**
+     * Outputs the event details based on the given options.
+     *
+     * @param Application $application The options used to configure the output
+     * @param Event $event The event to be output
+     * @return void
+     * @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;
+}
\ No newline at end of file