i would like to log every layers openings in PyQGIS, regardless of the opened project.
Is there a way to achieve that ?
Where should be the Python code be located in that case ?
Thanks for your help ! 


Question: What should I do with comments that need to be edited?
Answer: In this situation you edit it into the answer.

If the answer is incorrect and corrected in a comment, which is itself incorrect then correcting the comment seems more than a little ridiculous. Add all the information into the answer instead and everything's in one place.

Be careful doing this. People sometimes don't like editing of code. Ensure that your edit summary states that you're moving useful information from a comment into the post and I would link to the documentation that proves you're correct. I know nothing about the subject so I'm not making the edit myself.

Don't be upset if your edit gets rejected. If it does all shrug your shoulders and move on; it's only an "s" after all; you'd hope people would work it out if they copied and pasted the code and got an error.

If your edit is approved you can flag all the comments as obsolete and help keep the place that little bit cleaner.