forked from mollie/WooCommerce
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes mollie#892 - Push Psr\Log to custom namespace to prevent depend…
…ency conflicts
- Loading branch information
Leander Huysse
committed
Aug 5, 2024
1 parent
149c74d
commit 159e489
Showing
37 changed files
with
892 additions
and
94 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,128 @@ | ||
<?php | ||
|
||
namespace Mollie\WooCommerce\Vendor\Psr\Log; | ||
|
||
/** | ||
* This is a simple Logger implementation that other Loggers can inherit from. | ||
* | ||
* It simply delegates all log-level-specific methods to the `log` method to | ||
* reduce boilerplate code that a simple Logger that does the same thing with | ||
* messages regardless of the error level has to implement. | ||
*/ | ||
abstract class AbstractLogger implements LoggerInterface | ||
{ | ||
/** | ||
* System is unusable. | ||
* | ||
* @param string $message | ||
* @param mixed[] $context | ||
* | ||
* @return void | ||
*/ | ||
public function emergency($message, array $context = array()) | ||
{ | ||
$this->log(LogLevel::EMERGENCY, $message, $context); | ||
} | ||
|
||
/** | ||
* Action must be taken immediately. | ||
* | ||
* Example: Entire website down, database unavailable, etc. This should | ||
* trigger the SMS alerts and wake you up. | ||
* | ||
* @param string $message | ||
* @param mixed[] $context | ||
* | ||
* @return void | ||
*/ | ||
public function alert($message, array $context = array()) | ||
{ | ||
$this->log(LogLevel::ALERT, $message, $context); | ||
} | ||
|
||
/** | ||
* Critical conditions. | ||
* | ||
* Example: Application component unavailable, unexpected exception. | ||
* | ||
* @param string $message | ||
* @param mixed[] $context | ||
* | ||
* @return void | ||
*/ | ||
public function critical($message, array $context = array()) | ||
{ | ||
$this->log(LogLevel::CRITICAL, $message, $context); | ||
} | ||
|
||
/** | ||
* Runtime errors that do not require immediate action but should typically | ||
* be logged and monitored. | ||
* | ||
* @param string $message | ||
* @param mixed[] $context | ||
* | ||
* @return void | ||
*/ | ||
public function error($message, array $context = array()) | ||
{ | ||
$this->log(LogLevel::ERROR, $message, $context); | ||
} | ||
|
||
/** | ||
* Exceptional occurrences that are not errors. | ||
* | ||
* Example: Use of deprecated APIs, poor use of an API, undesirable things | ||
* that are not necessarily wrong. | ||
* | ||
* @param string $message | ||
* @param mixed[] $context | ||
* | ||
* @return void | ||
*/ | ||
public function warning($message, array $context = array()) | ||
{ | ||
$this->log(LogLevel::WARNING, $message, $context); | ||
} | ||
|
||
/** | ||
* Normal but significant events. | ||
* | ||
* @param string $message | ||
* @param mixed[] $context | ||
* | ||
* @return void | ||
*/ | ||
public function notice($message, array $context = array()) | ||
{ | ||
$this->log(LogLevel::NOTICE, $message, $context); | ||
} | ||
|
||
/** | ||
* Interesting events. | ||
* | ||
* Example: User logs in, SQL logs. | ||
* | ||
* @param string $message | ||
* @param mixed[] $context | ||
* | ||
* @return void | ||
*/ | ||
public function info($message, array $context = array()) | ||
{ | ||
$this->log(LogLevel::INFO, $message, $context); | ||
} | ||
|
||
/** | ||
* Detailed debug information. | ||
* | ||
* @param string $message | ||
* @param mixed[] $context | ||
* | ||
* @return void | ||
*/ | ||
public function debug($message, array $context = array()) | ||
{ | ||
$this->log(LogLevel::DEBUG, $message, $context); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<?php | ||
|
||
namespace Mollie\WooCommerce\Vendor\Psr\Log; | ||
|
||
class InvalidArgumentException extends \InvalidArgumentException | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?php | ||
|
||
namespace Mollie\WooCommerce\Vendor\Psr\Log; | ||
|
||
/** | ||
* Describes log levels. | ||
*/ | ||
class LogLevel | ||
{ | ||
const EMERGENCY = 'emergency'; | ||
const ALERT = 'alert'; | ||
const CRITICAL = 'critical'; | ||
const ERROR = 'error'; | ||
const WARNING = 'warning'; | ||
const NOTICE = 'notice'; | ||
const INFO = 'info'; | ||
const DEBUG = 'debug'; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?php | ||
|
||
namespace Mollie\WooCommerce\Vendor\Psr\Log; | ||
|
||
/** | ||
* Describes a logger-aware instance. | ||
*/ | ||
interface LoggerAwareInterface | ||
{ | ||
/** | ||
* Sets a logger instance on the object. | ||
* | ||
* @param LoggerInterface $logger | ||
* | ||
* @return void | ||
*/ | ||
public function setLogger(LoggerInterface $logger); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
|
||
namespace Mollie\WooCommerce\Vendor\Psr\Log; | ||
|
||
/** | ||
* Basic Implementation of LoggerAwareInterface. | ||
*/ | ||
trait LoggerAwareTrait | ||
{ | ||
/** | ||
* The logger instance. | ||
* | ||
* @var LoggerInterface|null | ||
*/ | ||
protected $logger; | ||
|
||
/** | ||
* Sets a logger. | ||
* | ||
* @param LoggerInterface $logger | ||
*/ | ||
public function setLogger(LoggerInterface $logger) | ||
{ | ||
$this->logger = $logger; | ||
} | ||
} |
Oops, something went wrong.