You are here

class StashLogger in Backup and Migrate 8.4

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.

Class StashLogger.

@package BackupMigrate\Core\Service

Hierarchy

  • class \BackupMigrate\Core\Service\StashLogger extends \Psr\Log\AbstractLogger

Expanded class hierarchy of StashLogger

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

File

lib/backup_migrate_core/src/Service/StashLogger.php, line 16

Namespace

BackupMigrate\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
   *
   * @return null
   */
  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.