Heyo,
I've worked with Nuke for a while and I've realized the logging within nuke
is a bit nuanced. At my facility I implemented a global logger that most of
our tools use, including Nuke. In Maya, I swap the stream handler with the
maya.utils.MayaGuiLogHandler(). I have not come across a similar handler
for Nuke, so I wrote a simple custom logging handler.

class NukeLogHandler(logging.Handler):
    def emit(self, record):
        if record.levelno >= logging.CRITICAL:
            nuke.critical(record.getMessage())
        elif record.levelno >= logging.ERROR:
            nuke.error(record.getMessage())
        elif record.levelno >= logging.WARNING:
            nuke.warning(record.getMessage())
        else:
            nuke.debug(record.getMessage())
        nuke.tprint("%s: %s" % (record.levelname,record.getMessage()))

First I noticed that there is no nuke.info level to map to the standard
logging levels. I'd like to present errors and warnings to the user in a
nice way. Maya has a common method of bubbling these messages up that's not
intrusive, but nuke only seems to have nuke.critical() and nuke.message().
Popups are so intrusive, that I'd like to find another way to handle
certain message. The command console prints information for these messages,
but that's often hidden beneath the main nuke window.

Can anyone offer any suggestions to make this better?

Cheers,
Jesse
_______________________________________________
Nuke-python mailing list
Nuke-python@support.thefoundry.co.uk, http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python

Reply via email to