You are here

public static function StructureSyncHelper::logMessage in Structure Sync 8

Same name and namespace in other branches
  1. 2.x src/StructureSyncHelper.php \Drupal\structure_sync\StructureSyncHelper::logMessage()

General function for logging messages.

24 calls to StructureSyncHelper::logMessage()
BlocksController::blocksImportFinishedCallback in src/Controller/BlocksController.php
Function that signals that the import of custom blocks has finished.
BlocksController::deleteBlocks in src/Controller/BlocksController.php
Function to delete all custom blocks.
BlocksController::deleteDeletedBlocks in src/Controller/BlocksController.php
Function to delete the custom blocks that should be removed in this import.
BlocksController::exportBlocks in src/Controller/BlocksController.php
Function to export custom blocks.
BlocksController::importBlocks in src/Controller/BlocksController.php
Function to import custom blocks.

... See full list

File

src/StructureSyncHelper.php, line 78

Class

StructureSyncHelper
Container of functions for importing and exporting content in structure.

Namespace

Drupal\structure_sync

Code

public static function logMessage($message, $type = NULL, $context = []) {
  $log = \Drupal::config('structure_sync.data')
    ->get('log');
  if (isset($log) && $log === FALSE) {
    return;
  }
  switch ($type) {
    case 'error':
      \Drupal::logger('structure_sync')
        ->error($message, $context);
      break;
    case 'warning':
      \Drupal::logger('structure_sync')
        ->warning($message, $context);
      break;
    default:
      \Drupal::logger('structure_sync')
        ->notice($message, $context);
      break;
  }
}