by James Boyd (1 Submission)
Category: Coding Standards
Compatability: Visual Basic 3.0
Difficulty: Intermediate
Date Added: Wed 3rd February 2021
Rating: (17 Votes)
This class, written by James Boyd, is a logger/error handler that does many things:
1.) Displays errors to users when they occur
2.) Records the activities of the application as various subroutines get executed
3.) When a run-time error happens, it can fire off an e-mail to the developer, replete with
routine name, error description, and even a dump of the app's execution stack at that point
4.) It can also maintain a text file which has the application's execution stack history
There are two ways of using this error handling/logging class:
1.) Use it just for error trapping
2.) Use it also for logging the execution path of an application. Since it captures the exact occurrence of a logged activity down to the THOUSANDTH of a second, it can be extremely useful for performing performance/efficiency analysis on subroutines.
Inputs
The primary public method is ".Log", where you can supply the necessary and optional parameters. It's designed to be very easy to use, and as unencumbering as possible when installing error-handling or application logging throuhgout your code.
Assumes
This is a class, and for optimum usage, should be a global object. This allows you to use CAppLog whenever and wherever you want throughout all of the code in your forms, general modules, classes, active reports, etc.
Code Returns
Logs application activities and/or errors, and displays elegant user error messages. It can also e-mail the author when a run-time error is trapped, and also logs all activities and errors to an external text file.
Side Effects
You will be forced to be a better coder! CAppLog will help you toward this goal.
API DeclarationsPrivate Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hWnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
Private Declare Function GetDesktopWindow Lib "user32" () As Long
Download Powerful & Flexible Application Logger & Error Handler (5 KB)