-
Notifications
You must be signed in to change notification settings - Fork 0
Code Annotated
This page talks through various features implemented within my specific project. This is not an attempt to be exhaustive, but to highlight elements that may make understanding and adoption more successful.
This demonstration solution contains three projects: a console application that is an event source, an example class for showing a second event source, and last a unit test project.
The project shows two different files, both named "Logger.cs" inside each project. Each of these Logger classes is internal and sealed. This is attempt to bond log events closely to the project being described.
Also note that each Logger class is a named event source. This allows the event sink(s) to pay attention to different areas of the application in different ways, a very handy feature when applications become more complex.
I've chosen to implement public methods that wrap each of the actual log events. The public methods are identified to the event source with a code attribute of "NonEvent," which essentially tells the semantic logging framework to ignore the method. As usual with public/private pairing, this allows the public method to buffer any changes that might be necessary to the private method. Private methods are identified with a code attribute of "Event."
This constant is not required, but I included it as a way of communicating to the log what app was involved. This is important if the sink is capturing content from a large application or if a log-aggregator (i.e. Loggly) is capturing a potentially much larger stream of content.
This application name is included a
Succeed: incrementally, based on user engagement, and driven by data.