Add a logger option

This allows to use a custom logger instead of console.