| 1 |
<?php |
| 2 |
/** |
| 3 |
* Logger service |
| 4 |
* |
| 5 |
* @package SeQura/WC |
| 6 |
* @subpackage SeQura/WC/Services |
| 7 |
*/ |
| 8 |
|
| 9 |
namespace SeQura\WC\Services; |
| 10 |
|
| 11 |
use SeQura\Core\Infrastructure\Logger\LogContextData; |
| 12 |
use Throwable; |
| 13 |
|
| 14 |
/** |
| 15 |
* Logger service |
| 16 |
*/ |
| 17 |
interface Interface_Logger_Service { |
| 18 |
|
| 19 |
/** |
| 20 |
* Log a message with the severity "WARNING". |
| 21 |
* |
| 22 |
* @param string $message The message to log. |
| 23 |
* @param string|null $func The method name. |
| 24 |
* @param string|null $class_name The class name. |
| 25 |
* @param LogContextData[] $context The context. |
| 26 |
*/ |
| 27 |
public function log_warning( $message, $func = null, $class_name = null, $context = array() ): void; |
| 28 |
|
| 29 |
/** |
| 30 |
* Log a message with the severity "INFO". |
| 31 |
* |
| 32 |
* @param string $message The message to log. |
| 33 |
* @param string|null $func The method name. |
| 34 |
* @param string|null $class_name The class name. |
| 35 |
* @param LogContextData[] $context The context. |
| 36 |
*/ |
| 37 |
public function log_info( $message, $func = null, $class_name = null, $context = array() ): void; |
| 38 |
|
| 39 |
/** |
| 40 |
* Log a message with the severity "DEBUG". |
| 41 |
* |
| 42 |
* @param string $message The message to log. |
| 43 |
* @param string|null $func The method name. |
| 44 |
* @param string|null $class_name The class name. |
| 45 |
* @param LogContextData[] $context The context. |
| 46 |
*/ |
| 47 |
public function log_debug( $message, $func = null, $class_name = null, $context = array() ): void; |
| 48 |
|
| 49 |
/** |
| 50 |
* Log a message with the severity "ERROR". |
| 51 |
* |
| 52 |
* @param string $message The message to log. |
| 53 |
* @param string|null $func The method name. |
| 54 |
* @param string|null $class_name The class name. |
| 55 |
* @param LogContextData[] $context The context. |
| 56 |
*/ |
| 57 |
public function log_error( $message, $func = null, $class_name = null, $context = array() ): void; |
| 58 |
|
| 59 |
/** |
| 60 |
* Log a message with the severity "ERROR". |
| 61 |
* |
| 62 |
* @param Throwable $throwable The throwable to log. |
| 63 |
* @param string|null $func The method name. |
| 64 |
* @param string|null $class_name The class name. |
| 65 |
* @param LogContextData[] $context Additional context. |
| 66 |
*/ |
| 67 |
public function log_throwable( Throwable $throwable, $func = null, $class_name = null, $context = array() ): void; |
| 68 |
|
| 69 |
/** |
| 70 |
* Get the content of the log file. |
| 71 |
* |
| 72 |
* @param string $store_id The store ID. |
| 73 |
* @throws \Exception If something goes wrong. The exception message will contain the error message. |
| 74 |
* |
| 75 |
* @return string[] Each element is a line of the log file. |
| 76 |
*/ |
| 77 |
public function get_content( $store_id ): array; |
| 78 |
|
| 79 |
/** |
| 80 |
* Clear the log file. |
| 81 |
* |
| 82 |
* @param string $store_id The store ID. |
| 83 |
* @throws \Exception If something goes wrong. The exception message will contain the error message. |
| 84 |
*/ |
| 85 |
public function clear( $store_id ): void; |
| 86 |
|
| 87 |
/** |
| 88 |
* Check if logging is enabled. |
| 89 |
*/ |
| 90 |
public function is_enabled(): bool; |
| 91 |
|
| 92 |
/** |
| 93 |
* Set on/off the logger. |
| 94 |
* |
| 95 |
* @param bool $is_enabled True to enable the logger, false to disable it. |
| 96 |
*/ |
| 97 |
public function enable( $is_enabled ): void; |
| 98 |
|
| 99 |
/** |
| 100 |
* Get the minimum log level. |
| 101 |
*/ |
| 102 |
public function get_min_log_level(): int; |
| 103 |
|
| 104 |
/** |
| 105 |
* Set the minimum log level. |
| 106 |
* |
| 107 |
* @param int $level The minimum log level. |
| 108 |
*/ |
| 109 |
public function set_min_log_level( $level ): void; |
| 110 |
} |
| 111 |
|