NamespaceSystemLibrary.Common.Framework SystemLibrary.Common.Framework.Net.dll
ILogWriter is responsible for storing log messages
- Create a new class that implements ILogWriter
- Register your class as singleton implementation of the ILogWriterILogWriter
public interface ILogWriter
Examples
X
Program.cs/Startup.cs:
public void ConfigureServices(IServiceCollection services)
{
services.AddSingleton(typeof(YourLogWriter), typeof(ILogWriter));
}
OR:
services.AddFrameworkServices<YourLogWriter>(
Your LogWriter implementation:
public class YourLogWriter : ILogWriter
{
public void Error(string message)
{
//Write message to slack? CloudWatch? Sentry.io? Local disc? Its up to you
}
...
}
Usage
// The hierarchy is as follows:
Log.Write("hello world");
Log.Critical("hello world");
Log.Error("hello world");
Log.Debug("hello world");
Log.Warning("hello world");
Log.Info("hello world");
Log.Trace("hello world");
All calls to method in 'Log' will create a message, append various data, and pass it to your log writer
Arguments
X
Methods
Implement the writing of warning messages
Note: Write() will always be invoked, even if you disable logging in appSettings
void Write(string message)
Extension Methods
}