"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/Log/Log.php" between
cakephp-4.0.1.tar.gz and cakephp-4.0.2.tar.gz

About: CakePHP is a rapid development framework for PHP applications. Source code.

Log.php  (cakephp-4.0.1):Log.php  (cakephp-4.0.2)
skipping to change at line 199 skipping to change at line 199
* adapters. * adapters.
* *
* @return void * @return void
*/ */
protected static function _loadConfig(): void protected static function _loadConfig(): void
{ {
foreach (static::$_config as $name => $properties) { foreach (static::$_config as $name => $properties) {
if (isset($properties['engine'])) { if (isset($properties['engine'])) {
$properties['className'] = $properties['engine']; $properties['className'] = $properties['engine'];
} }
if (!static::$_registry->has($name)) { if (!static::$_registry->has((string)$name)) {
static::$_registry->load($name, $properties); static::$_registry->load((string)$name, $properties);
} }
} }
} }
/** /**
* Reset all the connected loggers. This is useful to do when changing the l ogging * Reset all the connected loggers. This is useful to do when changing the l ogging
* configuration or during testing when you want to reset the internal state of the * configuration or during testing when you want to reset the internal state of the
* Log class. * Log class.
* *
* Resets the configured logging adapters, as well as any custom logging lev els. * Resets the configured logging adapters, as well as any custom logging lev els.
skipping to change at line 344 skipping to change at line 344
* intersect with the defined levels & scopes for a logger. * intersect with the defined levels & scopes for a logger.
* *
* ### Unhandled log messages * ### Unhandled log messages
* *
* If no configured logger can handle a log message (because of level or sco pe restrictions) * If no configured logger can handle a log message (because of level or sco pe restrictions)
* then the logged message will be ignored and silently dropped. You can che ck if this has happened * then the logged message will be ignored and silently dropped. You can che ck if this has happened
* by inspecting the return of write(). If false the message was not handled . * by inspecting the return of write(). If false the message was not handled .
* *
* @param int|string $level The severity level of the message being written. * @param int|string $level The severity level of the message being written.
* The value must be an integer or string matching a known level. * The value must be an integer or string matching a known level.
* @param mixed $message Message content to log * @param string $message Message content to log
* @param string|array $context Additional data to be used for logging the m essage. * @param string|array $context Additional data to be used for logging the m essage.
* The special `scope` key can be passed to be used for further filtering o f the * The special `scope` key can be passed to be used for further filtering o f the
* log engines to be used. If a string or a numerically index array is pass ed, it * log engines to be used. If a string or a numerically index array is pass ed, it
* will be treated as the `scope` key. * will be treated as the `scope` key.
* See Cake\Log\Log::setConfig() for more information on logging scopes. * See Cake\Log\Log::setConfig() for more information on logging scopes.
* @return bool Success * @return bool Success
* @throws \InvalidArgumentException If invalid level is passed. * @throws \InvalidArgumentException If invalid level is passed.
*/ */
public static function write($level, $message, $context = []): bool public static function write($level, string $message, $context = []): bool
{ {
static::_init(); static::_init();
if (is_int($level) && in_array($level, static::$_levelMap, true)) { if (is_int($level) && in_array($level, static::$_levelMap, true)) {
$level = array_search($level, static::$_levelMap, true); $level = array_search($level, static::$_levelMap, true);
} }
if (!in_array($level, static::$_levels, true)) { if (!in_array($level, static::$_levels, true)) {
throw new InvalidArgumentException(sprintf('Invalid log level "%s"', /** @psalm-suppress PossiblyFalseArgument */
$level)); throw new InvalidArgumentException(sprintf('Invalid log level `%s`',
$level));
} }
$logged = false; $logged = false;
$context = (array)$context; $context = (array)$context;
if (isset($context[0])) { if (isset($context[0])) {
$context = ['scope' => $context]; $context = ['scope' => $context];
} }
$context += ['scope' => []]; $context += ['scope' => []];
foreach (static::$_registry->loaded() as $streamName) { foreach (static::$_registry->loaded() as $streamName) {
 End of changes. 4 change blocks. 
6 lines changed or deleted 7 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)