0

I am currently in the process of designing a .net logging library that could potentially be used across different solutions in our organisation as a nuget package. However, I also want to make sure that we do semantic logging so that the logs are still structured.

Example - CustomEventSource.Log.OrderProcessingFailed(order.OrderNumber, order.ItemCount);

Given that I am creating a shared service that is application agnostic, it shouldn't be tightly coupled to the application. Here is an example flow.

  1. Developer creates application and downloads logging package
  2. Developer creates EventsIds (e.g. OrderProcessingFailed), categories, keywords etc... specific to their application
  3. Developer creates instance of logging component passing details like machine name, event source name.
  4. Developer creates logs using logging instance passing details created in step 2 AND an array of name value parameters that are relevant (e.g OrderNumber: 1234, ItemCount: 3).
  5. Logging library writes the events in ETW.
  6. External listeners captures the events.

Has anyone seen a solution resembling above? My question is more on how to implement step 2 above. I don't want EventId to be free text but it should be something that the client is "forced" to implement similar to how an interface gives you an idea of how to implement what is required.

I know my question is a bit vague at this point so clarifications are welcome.

MichaelChan
  • 1,808
  • 17
  • 34
  • 1
    Why don't you check one of the many libraries that already provide semantic logging? Eg, Serilog, SLAB from Patterns & Practices – Panagiotis Kanavos Apr 11 '17 at 10:50
  • I feel this question should belong to https://softwareengineering.stackexchange.com – Nikhil Vartak Apr 11 '17 at 10:52
  • Yes, I am planning to use entlib SLAB but I also need to implement my own structure so that users of my library in my organisation will be guided by my API. – MichaelChan Apr 11 '17 at 10:56
  • @NikhilVartak when referring other sites, it is often helpful to point that [cross-posting is frowned upon](https://meta.stackexchange.com/tags/cross-posting/info) – gnat Apr 11 '17 at 12:35

0 Answers0