Skip to content

Instantly share code, notes, and snippets.

@achraf-jeday
Last active March 2, 2020 14:15
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save achraf-jeday/fae00ace9ce3ba335ebc47e577db68d2 to your computer and use it in GitHub Desktop.
Save achraf-jeday/fae00ace9ce3ba335ebc47e577db68d2 to your computer and use it in GitHub Desktop.
Drupal 8: Log error messages programmatically in a custom module.
// Logs a notice
\Drupal::logger('my_module')->notice($message);
// Logs an error
\Drupal::logger('my_module')->error($message);
// Logs an info
\Drupal::logger('my_module')->info($message);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment