You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, a logger is implicitly included in every plug-in, as per it's superclass. But what the superclass can't know is the name of your plug-in. The name is present in every log record, and in the vast landscape of hundreds or thousands of records it can be helpful to be able to distinguish between where a particular record originated from.
When you decorate your class with a logger, the decoration mechanism look up the name of your plug-in at run-time and append it to its records.
importpyblish.api@pyblish.api.logclassMyPlugin(pyblish.api.Plugin):
defprocess(self):
self.log.info("Hello world")
# pyblish.__main__.MyPlugin: Hello world #
Implementation
Apply a logger in a similar fashion, instead relying on meta-programming, similar to how plug-ins are currently evaluated to be pre-1.1 (i.e. using process_instance in favour of just process).
The logger will be applied implicitly, along with the name given when subclassing, eliminating the need to manually decorate any classes.
The text was updated successfully, but these errors were encountered:
Goal
Eliminate the need for
@pyblish.api.log
.Currently, a logger is implicitly included in every plug-in, as per it's superclass. But what the superclass can't know is the name of your plug-in. The name is present in every log record, and in the vast landscape of hundreds or thousands of records it can be helpful to be able to distinguish between where a particular record originated from.
For example, this plug-in.
Outputs..
# pyblish.pyblish.plugin.Plugin : Hello world #
When you decorate your class with a logger, the decoration mechanism look up the name of your plug-in at run-time and append it to its records.
Implementation
Apply a logger in a similar fashion, instead relying on meta-programming, similar to how plug-ins are currently evaluated to be pre-1.1 (i.e. using
process_instance
in favour of justprocess
).The logger will be applied implicitly, along with the name given when subclassing, eliminating the need to manually decorate any classes.
The text was updated successfully, but these errors were encountered: