System Library Common Framework
Search Results for

    *.Benchmark*,*.Tests*,*.ApiTests*,*.BaseTest*,DelegateJsonConverter,CalleeCancelledRequestException,ClientResponse,ContentType,OutputCachePolicy
    Show / Hide Table of Contents Show / Hide Table of Contents
    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 ILogWriter

    ILogWriter

    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 critical messages

    void Critical(string message)

    X
    Methods arguments
    Type Name Description
    string message

    Implement the writing of debug messages

    void Debug(string message)

    X
    Methods arguments
    Type Name Description
    string message

    Implement the writing of error messages

    void Error(string message)

    X
    Methods arguments
    Type Name Description
    string message

    Implement the writing of information messages

    void Information(string message)

    X
    Methods arguments
    Type Name Description
    string message

    Implement the writing of trace messages

    void Trace(string message)

    X
    Methods arguments
    Type Name Description
    string message

    Implement the writing of warning messages

    void Warning(string message)

    X
    Methods arguments
    Type Name Description
    string message

    Implement the writing of warning messages

    Note: Write() will always be invoked, even if you disable logging in appSettings

    void Write(string message)

    X
    Methods arguments
    Type Name Description
    string message

    Extension Methods

    ObjectExtensions.Json(object, bool)
    ObjectExtensions.Json(object, JsonSerializerOptions, bool, params JsonConverter[])
    ObjectExtensions.Json(object, params JsonConverter[])
    ObjectExtensions.Xml(object)

    }

    In This Article
    Package: nuget
    Source: github
    Website: System Library Common Framework