Updated logger with debug mode