DirectNotify - python

I’ve setup a project where I use a category I created to do things like:

notify.debug(“some message here”)

To handle all my printing so it can be all turned off when i don’t need all the extra information, but I can’t find out a way of lowering the severity level to let these get triggered without letting all of Panda spit it’s crap out.

To rephrase that so it’s clear, I’m trying to ONLY lower the severity for printing within my own code, not all of panda3d.

Anyone know how to do this?

When you create your notify object, you do something like this:

notify = directNotify.newCategory("MyNotifyName")

Now you can control that category’s severity level with one of:

notify-level-MyNotifyName debug
notify-level-MyNotifyName info
notify-level-MyNotifyName warning
notify-level-MyNotifyName error

appearing in your Config.prc file.


I also read somewhere you can specify that when creating an category? Is that right?

Well, you can also call:


to turn each of these levels on and off individually.


I was thinking of this:

‘logger’ has no explanation as to what it is, is it possible that it lets you specify the level (info/debug/warning/error)?

No. Logger is the object that handles the actual writing to the log file (or to the console). We don’t actually use it, generally; all DirectNotify outputs go to the same global Logger object. But you could create a different one if you wanted to route output to a different place, for instance to a custom logfile.

Note that you can read the DirectNotify code yourself to answer questions like this; it’s all written in Python and fairly straightforward.