Snippet - Efficient NETMF diagnostic logging for events, asserts and telemetry

I just posted Efficient NETMF diagnostic logging for events, asserts and telemetry on Codeshare. Feel free to discuss and make suggestions here.

5 Likes

This looks great. Thanks for posting.
Note: at the bottom the link says “Source available through nuget or at https://github.com/DotNetOpenAutomation/[b]serialwifi[/b]
but the note where the source is in the middle is correct.

It’s actually a sub-project of the serialwifi repo. It was wrong in both places, but description text is easier to update. :slight_smile:

It really belongs in its own repo, but nuget versioning is easier to manage this way.

@ mcalsyn - I am having problems understanding how to do the automatic source tagging and database, is there any docs on it?

From codeshare:

No real docs on the internals, but you can take two approaches:

MANUAL: generate your own codes manually in source code, and then just read the source code and record the tag values and the preceding comment line. Insert or update a database record with the tag value, software version, and formatting string from the comment. This just then relies on you manually maintaining the uniqueness of your tag values.

AUTOMATIC: read your source files, and each time an AutoTag is found, generate a unique number and insert that into your source code. The source tagger also needs to take the preceeding comment line (which starts with “//EventTag:”) and insert that value into the database along with the generated tag value (and probably other information, such as the software version number). This is best done as part of a build process or automated pre/post-checkin process.

Now the tricky part with the automatic method is that you don’t want to change tags values (the generated number) any more often than absolutely necessary, but that gets hard when you insert/delete lines, refactor code, and/or copy/paste code containing tags. There are a couple approaches to that… One is to assign tags based on their semantic position (a hash of the full namespace, class, function , preceeding code, event string and event call arguments) but that can result in falsely generating new values when they aren’t needed - not a big problem, but your database grows because the numbers churn more often.

The other method is to use hints from your source code repository sdk (like libgit2sharp) to detect code and only process the changed code.

I may still release my tagger like Radius, with a dual license - free for non-commercial use, but it will probably be mid July before I can revisit that code and decide what to do. I also have a couple advanced listeners (an SD listener and network uploader for instance) that I haven’t decided what to do with yet.