Mark Smith Posted December 11, 2009 Report Share Posted December 11, 2009 Still willing to play along... I have some re-use code that I have been re-using since LV 6 that provides Event logging services that can used to track system start-up shut-down and any errors that may have happened. It is based on an AE. All my developers have to do is drop this widget in their error chains and they always have a way to track back an error. It is so simple it isn't worth showing. It has three actions Start (Open log file write start-up time and create queue for new messages) Log if error (post to queue if an error) Stop (close log and kill queue) So with three wrapper (one for each) that gives us three VI's the developer has to use. So how would I write a LVOOP replacement that would actually be a one-to-one replacement? From what I understand of LVOOP, I'm either going to hide an AE in a LVOOP method, or my developers are going to start running more wires to use the LVOOP version. Take care, Ben OH! OH! - I actually have a useful answer (as opposed to my earlier post) to this one because I do the same thing with classes. I have an ErrorLogger class that has three public methods - Start Daemon, Stop Daemon, and Enqueue Error. Any time you want to start logging errors, start the daemon, To log an error, just drop the Enqueue Error VI in the error wire. When you want to stop logging errors, just call Stop Daemon. The daemon opens a ref to the error queue and starts waiting for anything on the queue. The Start Daemon vi has controls that let the user set the path to the log file, the max error log size (it starts throwing away old messages when the max size is reached), and whether or not enable error dialogs. The Enqueue Error vi just has error in and error out terminals - it gets a ref to the error queue by name and closes it when it exits. The Stop Daemon just has error terminals (all of my VI's have error terminals) All of the other stuff (like whether or not the Start Daemon has to create a new directory to create the error log file and the daemon itself) is in the private methods of the class and the user needs never worry about any of that. The HUGE advantage of this approach over a single action engine is that the Enqueue Error vi is reentrant - one part of the code can be spewing errors and logging them (and my code often does ) while another part of the code that also could log errors isn't blocked waiting on the AE. Mark 1 Quote Link to comment
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.