NSPR API Reference:Logging

This chapter describes the global functions you use to perform logging. NSPR provides a set of logging functions that conditionally write printf() style strings to the console or to a log file. NSPR uses this facility itself for its own development debugging purposes.

You can select events to be logged by module or level. A module is a user-defined class of log events. A level is a numeric value that indicates the seriousness of the event to be logged. You can combine module and level criteria to get highly selective logging.

NSPR also provides "assert"-style macros and functions to aid in application debugging.

Conditional Compilation and Execution

NSPR's logging facility is conditionally compiled in and enabled for applications using it. These controls are platform dependent. Logging is not compiled in for the Win16 platform. Logging is compiled into the NSPR debug builds; logging is not compiled into the NSPR optimized builds. The compile time #define values DEBUG or FORCE_PR_LOG enable NSPR logging for application programs.

To enable NSPR logging and/or the debugging aids in your application, compile using the NSPR debug build headers and runtime. Set one of the compile-time defines when you build your application.

Execution-time control of NSPR's logging uses two environment variables. These variables control which modules and levels are logged as well as the file name of the log file. By default, no logging is enabled at execution time.