How to Log Messages in Drupal 8

We are going to learn where are all the Drupal logs in our system. What types of messages exist and how to log the different types of messages. 

We are also going to create a custom module, with the help of which we are going to log messages as a new node is created. For that, we are going to be using the hook_entity_insert function in our .module file.

Here is the video on how to inject a service into another service: on the Logging API + example how to inject the logging service into another service:

Here is a video on how to inject a service into a custom form:

The full code of the module you may find here:

Meet the author

Nikolay is a Drupal PHP developer with more than 7 years of experience. Passion for teaching, passion for simplicity and effectiveness of the code are just some keywords that he cares about. See more ...
Drupal Up is a platform for learning Drupal ...

Drupal Dan promoting
The idea is though not just to be another platform with some boring videos but all the videos to be inspired by real-world problems. That means something that you will most probably need if you work with Drupal. We want you to be successful and we want to teach you everything we know about Drupal!
So watch the videos, try to follow and reproduce, ask questions and you will see you will be able to conquer this wonderful sea that Drupal 8 is.