Request for LoggerInterface example for Python
-
hi ...
so, does this ConsolePrint() example print immediately?
i guess it is not possible use it for a dialog, but...
it should be possible to print into a custom logger channel?
(i've seen a plugin doing that)would it be possible to get an example how to use
LoggerInterface.AddNewLogger ?the goal would be to add a console channel for a cmd plugin
and to "live" output console messages to that channel
while the plugin is processing one of its commands.
it would also be nice to share that channel for all my plugins
and to have a way to to open (show) and clear the console
before processingbest, index
EDIT:
i tried to port the C++ example to python...
https://developers.maxon.net/docs/cpp/2023_2/page_maxonapi_loggerinterface.html
but i fail with
myLogger.AddLoggerType(maxon.TARGETAUDIENCE.ALL, maxon.LoggerTypes.Application)
--> TypeError: unable to convert maxon.interface.Declaration to @net.maxon.interface.class-cR(sorry this is probably a bit off topic and should be in a separate thread)
edit [ferdinand]: This thread is a follow up question for the thread Write to C4D console in real time.
-
I have forked your posting, because it warrants a new thread as you already said yourself. We will answer your questions in the next days, I just moved the thread for now.
Thank you for your understanding,
Ferdinand -
Thanks Ferdinand,
right, its good to have this separated from the old thread.
there are two objectives mixed in here :
- know how to get and use a separate console channel
- get immediate output to a console or dialog (if that is possible)
-
Hi @indexofrefraction unfortunately this is not possible to implement your own interface within Python.
See Maxon API Introduction - Interface.So I would rather recommend you to take a look at the Python logging module.
Cheers,
Maxime. -
tx adam, i just want a new "private" channel in the console window
(apart from "Default", "Python", "Renderer" and "Team Render")
to separate the log of my plugins from the normal chit-chat ...Wouldn't a new instance of an existing interface (type) be enough for that?
(a reference to the normal python channel with a new name?) -
Hi @indexofrefraction, sorry for the late reply I completely overlooked your reply.
Unfortually no, this is not possible at the moment, if you want to do it, you should go to C++, take a look at LoggerInterface Manual.
Cheers,
Maxime. -
Hello @indexofrefraction,
without any further questions or replies, we will consider this topic to be solved by Monday and flag it accordingly.
Thank you for your understanding,
Ferdinand