Class CPBLogger

VOID Log(PB_LOC_ARGS, ULONG ulMsgType, PCTSTR pszFormat = NULL, ...);

VOID WLog(PB_LOC_ARGS, ULONG ulMsgType, HINSTANCE hModule, ULONG ulFormatStringId, ...);


Note that in the above prototypes the location macro PB_LOC_ARGS expands to PC[W]STR pszFile, ULONG ulLine.

pszFileSource code file name. Usually obtained via the __FILE__ preprocessor macro.

ulLineSource code line number. Usually obtained via the __LINE__ preprocessor macro.

ulMsgTypeOne of the message type constants.

pszFormatFormat string that is ultimately passed to the run-time library function vsprintf.

hModuleHandle to module containing string table resource into which ulFormatStringId is an index.

ulFormatStringIdString table resource identifier of the format string that is ultimately passed to the run-time library function vsprintf.


Versions of these functions are provided that accept either ANSI or Unicode strings. ANSI strings are always converted to Unicode when log messages are generated. Both versions are always simultaneously available in the lib to support explicit logging with mixed character sets.

The WLog method provides further support for internationalization. The log message format string can be specified as a resource table entry. In this case it is recommended that insertion elements into the format string only be used for data that does not need to be internationalized, e.g. file names or numerical data. It is usually not necessary to internationalize strings used solely for internal code diagnostic purposes. It would be appropriate to use this function only when the output of Paul Bunyan is to be viewed by persons other than developers. Passing NULL for the hModule parameter results in an attempt to load the string from the calling process. If the string table resides in a DLL, the parameter must be non-NULL.

Both functions are called using the location / type macros as follows:

lgr.Log (PB_VERBOSE, “Hello %s.”, “world”);