Logger, Where's it?

Hi!
Is threre a logger in panda3d?

Yes, it’s called Notify, and the related interfaces can be found in dtool/src/prc in the source.

You can use it by declaring this in one of your header files:

NotifyCategoryDeclNoExport(myCategory);

And this in the corresponding source file:

NotifyCategoryDef(myCategory, "");

Of course, you can replace “myCategory” with a more appropriate description of that category of log messages, such as “environment” or “weather”.

Then, you can use it like this:

myCategory_cat.error() << "Invalid value: " << myValue << "\n";

(or spam(), debug(), info(), or warning().)

You can use a .prc instruction like “notify-level-myCategory” to control the verbosity.
There are also configuration variables available for writing the notify output to a log file.

Hi!
Thank you for reply!
But I don’t understand how use the logger.
I don’t need to add a new notify category, are the default category notifies exist?

If not, I don’t understand where is the NotifyCategoryDeclNoExport declaration.

Thank a lot!

Could you explain what exactly it is that you’re trying to do?

I’m trying TO log my project :smiley:
For example to log a creatio of enemy, how can I do this?

File log or console log, bow can I decide?

Thanks

Well how are you creating the enemies? Can you put some code up and I might be able to help

I imagine that the main factor in decision would be whether you want to return to your logs after the program has ended. If so, then files might be a better choice. Otherwise, a simple console log (even something as simple as “print” statements sprinkled about) might well be enough.