Skip to content

Latest commit

 

History

History
80 lines (68 loc) · 2.07 KB

README.md

File metadata and controls

80 lines (68 loc) · 2.07 KB

Library.NET.Logging

Implementing ICustomLogger

You can use implement ICustomLogger like this:

ICustomLogger logger = new CustomLogger(new FileInfo("logfile.log"), true, LogLevel.Information);

You can then add it to DI as a singleton.

Methods

LogDebug

logger.LogDebug("This is a Debug message");

Output:

[Debug] <4/5/2022 1:42:26 PM> : This is Debug message

LogInformation

logger.LogInformation("This is Information message");

Output:

[Information] <4/5/2022 1:42:26 PM> : This is Information message

LogWarning

logger.LogWarning(new Exception("Test Warning Message"), "This is Warning message");

Output:

[Warning] <4/5/2022 2:04:21 PM> : This is Warning message
        Exception Message:Test Warning Message

LogTrace

logger.LogTrace(new Exception("Test Trace Message", new Exception("Testing the logger system with a test trace message.")), "This is Stacktrace message");

Output:

[Error] <4/5/2022 2:04:21 PM> : This is Stacktrace message
        Exception Message:Test Trace Message
        Inner Message:System.Exception: Testing the logger system with a test trace message.
            Stack Trace:

LogError

logger.LogError(new Exception("Test Error Message", new Exception("Testing the logger system with a test error message.")), "This is Error message");

Output:

[Error] <4/5/2022 2:04:21 PM> : This is Error message
        Exception Message:Test Error Message
        Inner Message:System.Exception: Testing the logger system with a test error message.

LogCritical

logger.LogCritical(new Exception("Test Critical Message", new Exception("Testing the logger system with a test critical message.")), "This is Critical message");

Output:

[Critical] <4/5/2022 2:04:21 PM> : This is Critical message
        Exception Message:Test Critical Message
        Inner Message:System.Exception: Testing the logger system with a test critical message.

Planned implementations

  • None

Outside Dependencies

  • None