[Debugger] Make console logging more thread-safe