Jump to content

Setting up NLog filtering in LabVIEW


Recommended Posts

I've got a working event logger that uses NLog.dll in LabVIEW. It does 95% of what I would like it to do, but I wanted to implement adding programmatic filtering. To filter a log event, you need to first create a rule (which works fine in LabVIEW), and than add a condition to it's list of Filters. The API reference for the ConditionExpression is here;

 

http://nlog-project.org/documentation/v4.0.0/html/T_NLog_Conditions_ConditionExpression.htm

 

There's an Operator that will convert a string to the Condition object that I need as an input to the ConditionExpression. But, since you can't call that in LabVIEW, anyone have any ideas on how to get around that? I suppose I could write a quick .dll myself that inputs a string and outputs the appropriate Condition object. Just didn't want to go down the path if I didn't have to.

 

post-53468-0-19404400-1440634628.png

Link to comment

Since that is an abstract class you can't instantiate it. Abstract classes are similar to interfaces. They describe an object interface and implement part of the object but leave out at least one method to be implemented by the end user. Even in a real .Net language you would have to create an actual implementation of this class in your code that derives from this abstract class and implements all abstract methods of it

 

LabVIEW can interface with .Net but can not derive from .Net classes itself. As such you can't pull this of without some external help. You will have to create a .Net assembly in VB or C# or any other .Net development platform that you are familiar in. This assembly has to impement your specific MyConditionExpression class that derives from  ConditionExpression and then you can instantiate that from your assembly and pass it to this method.

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.