Add a way to log with a specific element

For that we creat a function to get the element's name and some
macros to handle the different log levels
Some more minor fixes