notice example



    return $arguments;
  }

  /** * {@inheritdoc} */
  protected function execute(array $arguments) {
    // PHP installations using non-bundled GD do not have imagerotate.     if (!function_exists('imagerotate')) {
      $this->logger->notice('The image %file could not be rotated because the imagerotate() function is not available in this PHP installation.', ['%file' => $this->getToolkit()->getSource()]);
      return FALSE;
    }

    // Stores the original GD resource.     $original_res = $this->getToolkit()->getResource();

    if ($new_res = imagerotate($this->getToolkit()->getResource(), 360 - $arguments['degrees']$arguments['background_idx'])) {
      $this->getToolkit()->setResource($new_res);
      imagedestroy($original_res);

      // GIFs need to reassign the transparent color after performing the
parent::setUp();

    $auth = isset(static::$auth) ? [static::$auth] : [];
    $this->provisionResource([static::$format]$auth);
  }

  /** * Writes a log messages and retrieves it via the REST API. */
  public function testWatchdog(): void {
    // Write a log message to the DB.     $this->container->get('logger.channel.rest')->notice('Test message');
    // Get the ID of the written message.     $id = Database::getConnection()->select('watchdog', 'w')
      ->fields('w', ['wid'])
      ->condition('type', 'rest')
      ->orderBy('wid', 'DESC')
      ->range(0, 1)
      ->execute()
      ->fetchField();

    $this->initAuthentication();
    $url = Url::fromRoute(
      

  public function save(array $form, FormStateInterface $form_state) {
    $contact_form = $this->entity;
    $status = $contact_form->save();
    $contact_settings = $this->config('contact.settings');

    $edit_link = $this->entity->toLink($this->t('Edit'))->toString();
    $view_link = $contact_form->toLink($contact_form->label(), 'canonical')->toString();
    if ($status == SAVED_UPDATED) {
      $this->messenger()->addStatus($this->t('Contact form %label has been updated.', ['%label' => $view_link]));
      $this->logger('contact')->notice('Contact form %label has been updated.', ['%label' => $contact_form->label(), 'link' => $edit_link]);
    }
    else {
      $this->messenger()->addStatus($this->t('Contact form %label has been added.', ['%label' => $view_link]));
      $this->logger('contact')->notice('Contact form %label has been added.', ['%label' => $contact_form->label(), 'link' => $edit_link]);
    }

    // Update the default form.     if ($form_state->getValue('selected')) {
      $contact_settings
        ->set('default_form', $contact_form->id())
        ->save();
    }
$test_name = reset($names);
    $source->setValue($test_name, FALSE);

    $logger_factory = $this->prophesize(LoggerChannelFactoryInterface::class);
    $container = new ContainerBuilder();
    $container->set('logger.factory', $logger_factory->reveal());
    \Drupal::setContainer($container);

    // Reading a config storage with an invalid configuration logs a notice.     $channel = $this->prophesize(LoggerChannelInterface::class);
    $logger_factory->get('config')->willReturn($channel->reveal());
    $channel->notice('Missing required data for configuration: %config', Argument::withEntry('%config', $test_name))->shouldBeCalled();

    // Copy the config from the source storage to the target storage.     $target = new TestStorage();
    self::replaceStorageContents($source$target);

    // Test that all configuration is copied correctly and that the value of the     // config with the invalid configuration has not been copied to the target     // storage.     foreach ($names as $name) {
      if ($name === $test_name) {
        $this->assertFalse($source->read($name));
        
/** * {@inheritdoc} */
  protected function setUp(): void {
    parent::setUp();

    // Log in as user 1. Migrations in the UI can only be performed as user 1.     $this->drupalLogin($this->rootUser);

    // Create a migrate message for testing purposes.     \Drupal::logger('migrate_drupal_ui')->notice('A test message');

  }

  /** * Tests the upgrade report with the view enabled, disabled and uninstalled. */
  public function testUpgradeReport() {
    $session = $this->assertSession();

    $this->assertTrue(View::load('watchdog')->status(), 'Watchdog view is enabled');
    // Tests redirection to report page when the watchdog view is enabled.

  public function save(array $form, FormStateInterface $form_state) {
    $workspace = $this->entity;
    $workspace->setNewRevision(TRUE);
    $status = $workspace->save();

    $info = ['%info' => $workspace->label()];
    $context = ['@type' => $workspace->bundle(), '%info' => $workspace->label()];
    $logger = $this->logger('workspaces');

    if ($status == SAVED_UPDATED) {
      $logger->notice('@type: updated %info.', $context);
      $this->messenger->addMessage($this->t('Workspace %info has been updated.', $info));
    }
    else {
      $logger->notice('@type: added %info.', $context);
      $this->messenger->addMessage($this->t('Workspace %info has been created.', $info));
    }

    if ($workspace->id()) {
      $form_state->setValue('id', $workspace->id());
      $form_state->set('id', $workspace->id());

      
$migration_status = MigrationInterface::RESULT_FAILED;
      }

      switch ($migration_status) {
        case MigrationInterface::RESULT_COMPLETED:
          // Store the number processed in the sandbox.           $context['sandbox']['num_processed'] += static::$numProcessed;
          $message = new PluralTranslatableMarkup(
            $context['sandbox']['num_processed'], 'Upgraded @migration (processed 1 item total)', 'Upgraded @migration (processed @count items total)',
            ['@migration' => $migration_name]);
          $context['sandbox']['messages'][] = (string) $message;
          \Drupal::logger('migrate_drupal_ui')->notice($message);
          $context['sandbox']['num_processed'] = 0;
          $context['results']['successes']++;

          // If the completed migration has any follow-up migrations, add them           // to the batch migrations.           // @see onPostImport()           if (!empty(static::$followUpMigrations)) {
            foreach (static::$followUpMigrations as $migration_id => $migration) {
              if (!in_array($migration_id$context['sandbox']['migration_ids'], TRUE)) {
                // Add the follow-up migration ID to the batch migration IDs for                 // later execution.
'#submit' => ['::submitForm', '::save'],
    ];
    return $actions;
  }

  /** * {@inheritdoc} */
  public function save(array $form, FormStateInterface $form_state) {
    parent::save($form$form_state);
    $form_state->setRedirectUrl($this->entity->toUrl('collection'));
    $this->logger('language')->notice('The %language (%langcode) language has been updated.', ['%language' => $this->entity->label(), '%langcode' => $this->entity->id()]);
  }

}
                    // The unencoded format is that of the FLAC picture block. The fields are stored in big endian order as in FLAC, picture data is stored according to the relevant standard.                     // http://flac.sourceforge.net/format.html#metadata_block_picture                     $flac = new getid3_flac($this->getid3);
                    $flac->setStringMode(base64_decode($ThisFileInfo_ogg_comments_raw[$i]['value']));
                    $flac->parsePICTURE();
                    $info['ogg']['comments']['picture'][] = $flac->getid3->info['flac']['PICTURE'][0];
                    unset($flac);

                } elseif ($ThisFileInfo_ogg_comments_raw[$i]['key'] == 'COVERART') {

                    $data = base64_decode($ThisFileInfo_ogg_comments_raw[$i]['value']);
                    $this->notice('Found deprecated COVERART tag, it should be replaced in honor of METADATA_BLOCK_PICTURE structure');
                    /** @todo use 'coverartmime' where available */
                    $imageinfo = getid3_lib::GetDataImageSize($data);
                    if ($imageinfo === false || !isset($imageinfo['mime'])) {
                        $this->warning('COVERART vorbiscomment tag contains invalid image');
                        continue;
                    }

                    $ogg = new self($this->getid3);
                    $ogg->setStringMode($data);
                    $info['ogg']['comments']['picture'][] = array(
                        'image_mime'   => $imageinfo['mime'],
                        
$this->assertCount(1, $logger->getLogs());
    }

    public function testCountErrorsWithDebugProcessor()
    {
        $handler = new TestHandler();
        $processor = new DebugProcessor();
        $logger = new Logger(__METHOD__, [$handler][$processor]);

        $logger->debug('test message');
        $logger->info('test message');
        $logger->notice('test message');
        $logger->warning('test message');

        $logger->error('test message');
        $logger->critical('test message');
        $logger->alert('test message');
        $logger->emergency('test message');

        $this->assertSame(4, $logger->countErrors());
    }

    public function testGetLogsWithDebugProcessor2()
    {
$comment = $this->entity;
    $entity = $comment->getCommentedEntity();
    $field_name = $comment->getFieldName();
    $uri = $entity->toUrl();
    $logger = $this->logger('comment');

    if ($this->currentUser->hasPermission('post comments') && ($this->currentUser->hasPermission('administer comments') || $entity->{$field_name}->status == CommentItemInterface::OPEN)) {
      $comment->save();
      $form_state->setValue('cid', $comment->id());

      // Add a log entry.       $logger->notice('Comment posted: %subject.', [
        '%subject' => $comment->getSubject(),
        'link' => Link::fromTextAndUrl(t('View')$comment->toUrl()->setOption('fragment', 'comment-' . $comment->id()))->toString(),
      ]);

      // Explain the approval queue if necessary.       if (!$comment->isPublished()) {
        if (!$this->currentUser->hasPermission('administer comments')) {
          $this->messenger()->addStatus($this->t('Your comment has been queued for review by site administrators and will be published after approval.'));
        }
      }
      else {
        
protected function setTargetPath(Request $request): void
    {
        // session isn't required when using HTTP basic authentication mechanism for example         if ($request->hasSession() && $request->isMethodSafe() && !$request->isXmlHttpRequest()) {
            $this->saveTargetPath($request->getSession()$this->firewallName, $request->getUri());
        }
    }

    private function throwUnauthorizedException(AuthenticationException $authException): never
    {
        $this->logger?->notice(sprintf('No Authentication entry point configured, returning a %s HTTP response. Configure "entry_point" on the firewall "%s" if you want to modify the response.', Response::HTTP_UNAUTHORIZED, $this->firewallName));

        throw new HttpException(Response::HTTP_UNAUTHORIZED, $authException->getMessage()$authException[]$authException->getCode());
    }
}
if ($recipient_account) {
      $langcode = $recipient_account->getPreferredLangcode();
    }
    else {
      $langcode = $this->languageManager->getDefaultLanguage()->getId();
    }
    $params = ['context' => $this->configuration];

    $message = $this->mailManager->mail('system', 'action_send_email', $recipient$langcode$params);
    // Error logging is handled by \Drupal\Core\Mail\MailManager::mail().     if ($message['result']) {
      $this->logger->notice('Sent email to %recipient', ['%recipient' => $recipient]);
    }
  }

  /** * {@inheritdoc} */
  public function defaultConfiguration() {
    return [
      'recipient' => '',
      'subject' => '',
      'message' => '',
    ];
      if (!$sender_cloned->getEmail()) {
        $this->logger->error('Error sending auto-reply, missing sender e-mail address in %contact_form', [
          '%contact_form' => $contact_form->label(),
        ]);
      }
      else {
        $this->mailManager->mail('contact', 'page_autoreply', $sender_cloned->getEmail()$current_langcode$params);
      }
    }

    if (!$message->isPersonal()) {
      $this->logger->notice('%sender-name (@sender-from) sent an email regarding %contact_form.', [
        '%sender-name' => $sender_cloned->getAccountName(),
        '@sender-from' => $sender_cloned->getEmail() ?? '',
        '%contact_form' => $contact_form->label(),
      ]);
    }
    else {
      $this->logger->notice('%sender-name (@sender-from) sent %recipient-name an email.', [
        '%sender-name' => $sender_cloned->getAccountName(),
        '@sender-from' => $sender_cloned->getEmail(),
        '%recipient-name' => $message->getPersonalRecipient()->getAccountName(),
      ]);
    }

function hook_file_copy(\Drupal\file\FileInterface $file, \Drupal\file\FileInterface $source) {
  // Make sure that the file name starts with the owner's user name.   if (!str_starts_with($file->getFilename()$file->getOwner()->name)) {
    $file->setFilename($file->getOwner()->name . '_' . $file->getFilename());
    $file->save();

    \Drupal::logger('file')->notice('Copied file %source has been renamed to %destination', ['%source' => $source->filename, '%destination' => $file->getFilename()]);
  }
}

/** * Respond to a file that has been moved. * * @param \Drupal\file\FileInterface $file * The updated file entity after the move. * @param \Drupal\file\FileInterface $source * The original file entity before the move. * * @see \Drupal\file\FileRepositoryInterface::move() */
Home | Imprint | This part of the site doesn't use cookies.