Reputation: 675
I am using curses alongside the logging module and I'm having a problem with logging when curses is started.
Logging is working and prints some text to console (depending on the level) until curses.initscr()
is called.
Any idea on how to fix it?
Upvotes: 2
Views: 1470
Reputation: 28036
Once curses is initialized, you should perform all output through it - otherwise it'll look goofy (as you're seeing).
You can't just use print/sys.(stdout|stderr).write, as it'll interfere with ncurses output.
Best solution would be, make an ncurses pad to use for logging, redirect all log messages to it. You can customize your logging handler to do this (take a look at logging.handlers for some inspiration).
Upvotes: 4