Panda3D Manual: Log MessagesPanda periodically outputs log messages for debugging purposes. A typical log message might look like this: :util(warning): Adjusting global clock's real time by -3.3 seconds. The first part of the message, notify-level warning Directives like these tell panda which messages to show, and which to suppress. In the default configuration (shown above), all messages whose severity is
Note:There are two kinds of notifiers: the C++ one and a Pythonic (therefore 'direct'notify). You can distinguish them by the category name. Where C++ categories are always lowercase, Python categories are starting with a capital letter by convention (e.g. util, and ShowBase). The only differences in practice is that you set (all) Python notifiers with the prc option default-notify-level and C++ with notify-level, and Pythonic notifiers don't know the spam and fatal levels.
Sometimes it is interesting and educational to change the configuration to this: notify-level spam If you do this, panda will print out vast amounts of information while it runs. These informational messages can be useful for debugging. However, there are so many print-statements that it slows panda down to a crawl. So it may be desirable to tell panda to narrow it down a little. The way to do that is to name a particular module in the panda config file. For example, you might do this: notify-level warning This tells panda that module "glgsg" should print out everything it can, but that every other module should only print warnings and errors. By the way, module Generating your own Log MessagesYou can use the In Python this would look something like this: from direct.directnotify.DirectNotify import DirectNotify First you create a new notify category, which may be whatever you want, e.g. "PlayerMovement". It's a convention to have such a notifier for each bigger class or module. In the last line there is a warning() call, which indicates that the given text will be only printed if the severity level for this category is warning or debug. If the severity isn't set for this particular category, then the default-directnotify-level setting is taken. Redirecting Log Messages to a FileIf you wish, you can redirect all of panda's log messages into a file. The following snippet will do the trick: nout = MultiplexStream() Alternatively you may want to use the notify-output prc option, which expects a filename as argument: notify-output mygame-log.txt © Carnegie Mellon University 2010 |