NetModules.Logging.LocalLogging is a NetModules module that handles the built in LoggingEvent and outputs to Console if available, as well as logging to local files.
Every loaded Module in a loaded ModuleHost can raise a LoggingEvent either mannually by instantiating and sending it to Host.Handle, or by using the this.Log(severity, arguments) wrapper method.
Note
A Module doesn't need to worry about how logging is handled unless it's a logging Module!
The NetModules.Logging.LocalLogging module handles and exposes its own events for interacting with console logging and the local log files, these events can be referenced and raised by other modules to read log data.
- LastLine: Returns the last
LoggingEventrecord in the event output. - ReadLogFile: Returns n lines from the local log file in the event output.
- SearchLogFile: Returns n lines from the local log file that match a query in the event output.
- SetLoggingLevel: Allows you to dynamically override the logging level for a selected logger at runtime. This may be useful if you need to read a level urgently.
To use NetModules.Logging.LocalLogging, add the library to a project where you instantiate a ModuleHost via NuGet Package Manager:
Install-Package NetModules.Logging.LocalLoggingLogging will be automatically enabled when you load the module into your ModuleHost.
To use events from NetModules.Logging.LocalLogging.Events, add the events library as a reference to a Module project via NuGet Package Manager:
Install-Package NetModules.Logging.LocalLogging.EventsYou can then instantiate an event and raise it to ModuleHost via your module's this.Host.Handle method for a handling module to process.
We welcome contributions! To get involved:
- Fork NetModules.Logging.LocalLogging, make improvements, and submit a pull request.
- Code will be reviewed upon submission.
- Join discussions via the issues board.
This project must always strictly adhere to the NetModules architecture and design pattern!
NetModules.Logging.LocalLogging is licensed under the MIT License, allowing unrestricted use, modification, and distribution. If you use NetModules.Logging.LocalLogging in your own project, we’d love to hear about your experience, and possibly feature you on our website!
Full documentation coming soon!
This project references NetTools.Logging for strict ILogger implementation and unified Logger invocation.