Skip to content

Commit

Permalink
Patch Log code (#4631)
Browse files Browse the repository at this point in the history
  • Loading branch information
MGatner authored May 1, 2021
1 parent 8a1f8be commit 9896c24
Show file tree
Hide file tree
Showing 7 changed files with 152 additions and 112 deletions.
56 changes: 32 additions & 24 deletions system/ThirdParty/PSR/Log/AbstractLogger.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@ abstract class AbstractLogger implements LoggerInterface
* System is unusable.
*
* @param string $message
* @param array $context
* @return null
* @param array $context
*
* @return void
*/
public function emergency($message, array $context = [])
public function emergency($message, array $context = array())
{
$this->log(LogLevel::EMERGENCY, $message, $context);
}
Expand All @@ -30,10 +31,11 @@ public function emergency($message, array $context = [])
* trigger the SMS alerts and wake you up.
*
* @param string $message
* @param array $context
* @return null
* @param array $context
*
* @return void
*/
public function alert($message, array $context = [])
public function alert($message, array $context = array())
{
$this->log(LogLevel::ALERT, $message, $context);
}
Expand All @@ -44,10 +46,11 @@ public function alert($message, array $context = [])
* Example: Application component unavailable, unexpected exception.
*
* @param string $message
* @param array $context
* @return null
* @param array $context
*
* @return void
*/
public function critical($message, array $context = [])
public function critical($message, array $context = array())
{
$this->log(LogLevel::CRITICAL, $message, $context);
}
Expand All @@ -57,10 +60,11 @@ public function critical($message, array $context = [])
* be logged and monitored.
*
* @param string $message
* @param array $context
* @return null
* @param array $context
*
* @return void
*/
public function error($message, array $context = [])
public function error($message, array $context = array())
{
$this->log(LogLevel::ERROR, $message, $context);
}
Expand All @@ -72,10 +76,11 @@ public function error($message, array $context = [])
* that are not necessarily wrong.
*
* @param string $message
* @param array $context
* @return null
* @param array $context
*
* @return void
*/
public function warning($message, array $context = [])
public function warning($message, array $context = array())
{
$this->log(LogLevel::WARNING, $message, $context);
}
Expand All @@ -84,10 +89,11 @@ public function warning($message, array $context = [])
* Normal but significant events.
*
* @param string $message
* @param array $context
* @return null
* @param array $context
*
* @return void
*/
public function notice($message, array $context = [])
public function notice($message, array $context = array())
{
$this->log(LogLevel::NOTICE, $message, $context);
}
Expand All @@ -98,10 +104,11 @@ public function notice($message, array $context = [])
* Example: User logs in, SQL logs.
*
* @param string $message
* @param array $context
* @return null
* @param array $context
*
* @return void
*/
public function info($message, array $context = [])
public function info($message, array $context = array())
{
$this->log(LogLevel::INFO, $message, $context);
}
Expand All @@ -110,10 +117,11 @@ public function info($message, array $context = [])
* Detailed debug information.
*
* @param string $message
* @param array $context
* @return null
* @param array $context
*
* @return void
*/
public function debug($message, array $context = [])
public function debug($message, array $context = array())
{
$this->log(LogLevel::DEBUG, $message, $context);
}
Expand Down
16 changes: 8 additions & 8 deletions system/ThirdParty/PSR/Log/LogLevel.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@
namespace Psr\Log;

/**
* Describes log levels
* 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';
const ALERT = 'alert';
const CRITICAL = 'critical';
const ERROR = 'error';
const WARNING = 'warning';
const NOTICE = 'notice';
const INFO = 'info';
const DEBUG = 'debug';
}
7 changes: 4 additions & 3 deletions system/ThirdParty/PSR/Log/LoggerAwareInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,16 @@
namespace Psr\Log;

/**
* Describes a logger-aware instance
* Describes a logger-aware instance.
*/
interface LoggerAwareInterface
{
/**
* Sets a logger instance on the object
* Sets a logger instance on the object.
*
* @param LoggerInterface $logger
* @return null
*
* @return void
*/
public function setLogger(LoggerInterface $logger);
}
8 changes: 6 additions & 2 deletions system/ThirdParty/PSR/Log/LoggerAwareTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,16 @@
*/
trait LoggerAwareTrait
{
/** @var LoggerInterface */
/**
* The logger instance.
*
* @var LoggerInterface
*/
protected $logger;

/**
* Sets a logger.
*
*
* @param LoggerInterface $logger
*/
public function setLogger(LoggerInterface $logger)
Expand Down
93 changes: 53 additions & 40 deletions system/ThirdParty/PSR/Log/LoggerInterface.php
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
<?php namespace Psr\Log;
<?php

namespace Psr\Log;

/**
* Describes a logger instance
* Describes a logger instance.
*
* The message MUST be a string or object implementing __toString().
*
* The message MAY contain placeholders in the form: {foo} where foo
* will be replaced by the context data in key "foo".
*
* The context array can contain arbitrary data, the only assumption that
* The context array can contain arbitrary data. The only assumption that
* can be made by implementors is that if an Exception instance is given
* to produce a stack trace, it MUST be in a key named "exception".
*
Expand All @@ -20,93 +22,104 @@ interface LoggerInterface
/**
* System is unusable.
*
* @param string $message
* @param array $context
* @return null
* @param string $message
* @param mixed[] $context
*
* @return void
*/
public function emergency($message, array $context = []);
public function emergency($message, array $context = array());

/**
* 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 array $context
* @return null
* @param string $message
* @param mixed[] $context
*
* @return void
*/
public function alert($message, array $context = []);
public function alert($message, array $context = array());

/**
* Critical conditions.
*
* Example: Application component unavailable, unexpected exception.
*
* @param string $message
* @param array $context
* @return null
* @param string $message
* @param mixed[] $context
*
* @return void
*/
public function critical($message, array $context = []);
public function critical($message, array $context = array());

/**
* Runtime errors that do not require immediate action but should typically
* be logged and monitored.
*
* @param string $message
* @param array $context
* @return null
* @param string $message
* @param mixed[] $context
*
* @return void
*/
public function error($message, array $context = []);
public function error($message, array $context = array());

/**
* 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 array $context
* @return null
* @param string $message
* @param mixed[] $context
*
* @return void
*/
public function warning($message, array $context = []);
public function warning($message, array $context = array());

/**
* Normal but significant events.
*
* @param string $message
* @param array $context
* @return null
* @param string $message
* @param mixed[] $context
*
* @return void
*/
public function notice($message, array $context = []);
public function notice($message, array $context = array());

/**
* Interesting events.
*
* Example: User logs in, SQL logs.
*
* @param string $message
* @param array $context
* @return null
* @param string $message
* @param mixed[] $context
*
* @return void
*/
public function info($message, array $context = []);
public function info($message, array $context = array());

/**
* Detailed debug information.
*
* @param string $message
* @param array $context
* @return null
* @param string $message
* @param mixed[] $context
*
* @return void
*/
public function debug($message, array $context = []);
public function debug($message, array $context = array());

/**
* Logs with an arbitrary level.
*
* @param mixed $level
* @param string $message
* @param array $context
* @return null
* @param mixed $level
* @param string $message
* @param mixed[] $context
*
* @return void
*
* @throws \Psr\Log\InvalidArgumentException
*/
public function log($level, $message, array $context = []);
public function log($level, $message, array $context = array());
}
Loading

0 comments on commit 9896c24

Please sign in to comment.