Cross-platform debug message handling added (printf can still be used on supported platforms directly)