The ability to Log Errors is an important part of any application, but it can be time consuming to implement for every application.
This example attempts to simplify this process by providing a reusable, generic Error Logger API that may be well suited to various of applications.
Video Demonstration
Here is a short video (no audio) demonstration of the Error Logger example.
<object id="scPlayer" width="1189" height="861" type="application/x-shockwave-flash" data="http://content.screencast.com/users/jgcode/folders/LabVIEW/media/61776c29-d71d-4d07-a412-0bde3f4553d..." > <param name="movie" value="http://content.screencast.com/users/jgcode/folders/LabVIEW/media/61776c29-d71d-4d07-a412-0bde3f4553d..." /> <param name="quality" value="high" /> <param name="bgcolor" value="#FFFFFF" /> <param name="flashVars" value="thumb=http://content.screencast.com/users/jgcode/folders/LabVIEW/media/61776c29-d71d-4d07-a412-0bde3f4553d..." /> <param name="allowFullScreen" value="true" /> <param name="scale" value="showall" /> <param name="allowScriptAccess" value="always" /> <param name="base" value="http://content.screencast.com/users/jgcode/folders/LabVIEW/media/61776c29-d71d-4d07-a412-0bde3f4553d..." /> Unable to display content. Adobe Flash is required. </object>
The Error Logger allows a developer to easily do the following in their applications without the need to write specific code to:
Note: The Error Logger is not meant to replace providing Custom Error Handling - as that is specific to each application.
OR
Distribution Notes
The Error Logger API is installed at <user.lib>\_JGCODE\error_logger
It is available through the palettes at: JGCODE Library\Error Logger (that is why jgcode_rsc_jgcode_library_palette-1.2-1.ogp needs to be installed)
The format of the Error Report in the Error files is adapted from VIPM - when I was looking for an example to use, I liked this format the best, and replicated it for this example.
Tested with LabVIEW 2009 and LabVIEW 2010.
Note: Please ignore the Red Crosses in the palette, they do not impact this distribution in any way, only the way the icons in the palette look - I have already lodged the following CAR with NI - #185059.
Please note I am unable to include a VI Snippet as it removes Front Panel decorations that contain instructions and changes the "This VI Refnum" to a constant, breaking the example.
Please see the example VI as per Steps To Execute Code above.
Author's Notes
The Error Logger uses a Singleton architecture where a Class (data) is wrapped in a Data Value Reference (DVR).
This Reference is initialised on first call.
The DVR is stored in a Functional Global Variable (FGV) so it can be access anywhere throughout the application, but there is only ever one instance.
The DVR combined with the IPE makes creating wrappers for the Methods very easy.
Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.
Is it necessary to have VIPM for this? Is it possible to use this without the use of OpenG?
Thanks
Hi FraggerFox
Just to clarify - there is no mention of OpenG in the above document.
Actually, this package has no code dependencies.
The only dependency is the JGCODE Library Palette and you only need that if you want to expose it in the palettes (recommended).
I decided to release the code as a package (.vip/.ogp) as IMHO (and many others) this is a superior format for LabVIEW code distribution.
Anyways VIPM rocks! And its free - so what are you waiting for?
The LabVIEW Tools Network is also package-centric and has just kicked off - so I can't wait until packages go mainstream. I'm excited!
Cheers
-JG
Just to follow-up (not that it changes any of the above)....
This source code for this example does use OpenG VIs but all the supporting VIs are included in the distribution (so OpenG packages are not required and are not dependencies).
These are obviously re-namespaced so there will be no cross-linking etc... with installed OpenG packages
I thought it would be best to mention that - because OpenG rocks too
Anyways, here is the lowdown on packages straight from NI:
NI has adopted and backed the package format (which is the format used by VIPM) as the standard for distributing code on the LabVIEW Tools Network.
Cheers
-JG
Hi Jonathon,
Seems to be a nice code, but our company prohibits use of open source, so sadly I won't be able to try it
Document v14
- Final Entry (before deadline)
Document v15
- There is a code-only version that you can now download if you prefer.
- Please note: the example code has not changed, it has only been uploaded in a different format due to requests.
- Although not part of the original entry, I thought it best to centralise it here.
Found out that under LV2013 building an executable fails with error code 1055 if the Error Logger is used. Application builder can not specify which vi has caused the error.
Under developement system it runs just fine.