Skip to content

KissLog-net/KissLog.Sdk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

KissLog

Latest version Downloads

KissLog is the built-in .NET integration for saving the logs to logBee.net.

Check the documentation for a complete list of features.

.NET support

Why KissLog?

KissLog implements three main components: logging functionality, exceptions tracking and application insights.

For web applications, KissLog automatically captures all the HTTP properties.

KissLog keeps the log events in memory and sends them to the registered listeners all at once. This can help reduce the load of the persistence implementation (such as Disk I/O, database operations or network throughput).

Centralized logging using logBee.net or logBee on-premises app.

logBee.net centralized logging

Basic usage

using KissLog;
using KissLog.Listeners.FileListener;

namespace ConsoleApp
{
    class Program
    {
        static void Main(string[] args)
        {
            KissLogConfiguration.Listeners
                .Add(new LocalTextFileListener("logs", FlushTrigger.OnFlush));

            var logger = new Logger();

            logger.Trace("Hey, I am a log message");

            Logger.NotifyListeners(logger);
        }
    }
}

Saving the logs

KissLog saves the logs to multiple output locations by using log listeners.

Log listeners are registered at application startup using the KissLogConfiguration.Listeners container.

Custom log listeners can be easily implemented.

Using interceptors, log listeners can apply conditional filtering rules before saving the events.

namespace ConsoleApp
{
    class Program
    {
        static void Main(string[] args)
        {
            KissLogConfiguration.Listeners
                .Add(new LocalTextFileListener("logs", FlushTrigger.OnMessage))
                .Add(new CustomMongoDbListener("mongodb://localhost:27017", "Logs")
                {
                    Interceptor = new LogLevelInterceptor(LogLevel.Information)
                });

            var logger = new Logger();
            logger.Trace("Hey, I am a log message");

            Logger.NotifyListeners(logger);
        }
    }
}

Configuration

KissLog supports various configuration options using the KissLogConfiguration.Options configuration object.

private void ConfigureKissLog
{
    KissLogConfiguration.Options
        .AppendExceptionDetails((Exception ex) =>
        {
            if (ex is DivideByZeroException zeroDivisionEx)
                return ">>> Should check if the denominator is zero before dividing";

            return null;
        });
}

AppendExceptionDetails

Samples

Check the test applications for more examples of using KissLog.

Feedback

Please use the issues section to report bugs, suggestions and general feedback.

Contributing

All contributions are very welcomed: code, documentation, samples, bug reports, feature requests.

License

Apache-2.0

About

KissLog is a lightweight and highly customizable logging framework for .NET applications

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages