driver: Only output ANSI logging if connected to a terminal Fixes #78435. See #78435 for more. Cc `@RalfJung` `@oli-obk`