Publish2 logging from external script in the publish2 logging ui

Hi,

I’m currently working on tk-multi-publish2.

I’ve created a new publish2 plugin. In my code at some point I do:

   from  deadline_submission import exportAbc
   exportAbc.exportAbc(self, item, settings)

Inside this exportAbc.py, inside the exportAbc() I would like to log some infos, but I would like this to be displayed in the ui of the publish2 app. Is this possible ? Could you please help me with this ?

Regards

4 Likes

Replying to myself, I found this works :blush:

def exportAbc(hook, item, settings):

    hook.logger.info('example')
5 Likes

That works!
Another approach would be to use sgtk.LogManager.get_logger():

import sgtk
logger = sgtk.LogManager.get_logger(__name__)
logger.info("example")
4 Likes