added debug-enabled check before writing to logs