Color lost from logger message with Gtk.Application and GStreamer

I am writing an application with PyObject, based on Gtk.Application and having GStreamer. For logging system, I am using logbook with colorized handler.

The issue is that, only when I call logger.error in application __init__ method, the color is displayed. If I call somewhere else in the app (like in signal handler), all color is stripped.

May be it is because of threads setup done by Gtk.Application and GStreamer? Could someone explain?

I found the answer. So GLib logging facility take control of stderr, making logbook think that the stream is not TTY and disable colors.

To make the color printed, I created a custom logbook handler, and redirect its messages to GLib log.