Don't output deprecation error if no logging is enabled, allow more logging flexibility.

parent 80f626f2
......@@ -8,9 +8,11 @@ Exclamation symbols (:exclamation:) note something of importance e.g. breaking c
- [:ledger: View file changes][Unreleased]
### Added
### Changed
- Logging only updates or only debug/errors is now possible.
### Deprecated
### Removed
### Fixed
- Don't output deprecation notices if no logging is enabled.
### Security
## [0.59.0] - 2019-07-07
......
......@@ -88,8 +88,8 @@ class TelegramLog
*/
public static function initialize(LoggerInterface $logger = null, LoggerInterface $update_logger = null)
{
// Clearly deprecated code still being executed.
if ($logger === null) {
if ($logger === null && $update_logger === null) {
// Clearly deprecated code still being executed.
(defined('PHPUNIT_TESTSUITE') && PHPUNIT_TESTSUITE) || trigger_error('A PSR-3 compatible LoggerInterface object must be provided. Initialise with a preconfigured logger instance.', E_USER_DEPRECATED);
$logger = new Logger('bot_log');
} elseif ($logger instanceof Logger) {
......@@ -286,11 +286,12 @@ class TelegramLog
} elseif ($name === 'update') {
$logger = self::$update_logger;
$name = 'info';
} else {
return;
}
self::initialize(self::$logger, self::$update_logger);
// Clearly we have no logging enabled.
if ($logger === null) {
return;
}
// Replace any placeholders from the passed context.
if (count($arguments) >= 2) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment