Getting Started Logging with the API, Samples
Existing logging calls in your application are easily redirected to Paul Bunyan by one of three methods:
Modify the internals of the existing logging call
VOID MyLogFunction(CHAR* pszMessage)
{
// Obsolete OutputDebugString(pszMessage);
PBLog(PB_VERBOSE, pszMessage);
}
Or:
Private Sub MyLogFunction(strMessage As String)
'Obsolete debug.print strMessage
'Declare logger object
Dim lgr As New PBLogger
'Log a message
lgr.Log "INFO", strMessage
End Sub
Remap calls to the original function with a preprocessor macro
#define MyLogFunction(str) PBLog(PB_VERBOSE, (str))
Hook existing calls using Diamond Sierra’s freeware API Interceptor
In situations where it is not possible to modify existing code in external modules it is often easiest to simply hook (intercept) the logging calls dynamically at runtime. See Creating Log Messages using API Interception for more information.