You are here

class StashLogger in Backup and Migrate 5.0.x

Saves log entries to memory to be processed during the current process.

This simple service does no clearing or memory management so should not be used for a long-running process.

@package Drupal\backup_migrate\Core\Service

Hierarchy

  • class \Drupal\backup_migrate\Core\Service\StashLogger extends \Psr\Log\AbstractLogger

Expanded class hierarchy of StashLogger

1 file declares its use of StashLogger
Notify.php in src/Core/Filter/Notify.php

File

src/Core/Service/StashLogger.php, line 15

Namespace

Drupal\backup_migrate\Core\Service
View source
class StashLogger extends AbstractLogger {

  /**
   * @var array
   */
  protected $logs = [];

  /**
   * Logs with an arbitrary level.
   *
   * @param mixed $level
   * @param string $message
   * @param array $context
   */
  public function log($level, $message, array $context = []) {
    $this->logs[] = [
      'level' => $level,
      'message' => $message,
      'context' => $context,
    ];
  }

  /**
   * Get all of the log messages that were saved to this stash.
   *
   * @return array
   */
  public function getAll() {
    return $this->logs;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
StashLogger::$logs protected property
StashLogger::getAll public function Get all of the log messages that were saved to this stash.
StashLogger::log public function Logs with an arbitrary level.