GithubHelp home page GithubHelp logo

noahsurprenant / serilog-sinks-sqlite Goto Github PK

View Code? Open in Web Editor NEW

This project forked from saleem-mirza/serilog-sinks-sqlite

0.0 0.0 0.0 114 KB

A Serilog sink that writes to SQLite

License: Apache License 2.0

C# 97.52% PowerShell 2.48%

serilog-sinks-sqlite's Introduction

Serilog.Sinks.SQLite

A lightweight high performance Serilog sink that writes to SQLite database.

Getting started

Install Serilog.Sinks.SQLite from NuGet

Install-Package Serilog.Sinks.SQLite

Configure logger by calling WriteTo.SQLite()

var logger = new LoggerConfiguration()
    .WriteTo.SQLite(@"Logs\log.db")
    .CreateLogger();
    
logger.Information("This informational message will be written to SQLite database");

XML configuration

To use the SQLite sink with the Serilog.Settings.AppSettings package, first install that package if you haven't already done so:

Install-Package Serilog.Settings.AppSettings

In your code, call ReadFrom.AppSettings()

var logger = new LoggerConfiguration()
    .ReadFrom.AppSettings()
    .CreateLogger();

In your application's App.config or Web.config file, specify the SQLite sink assembly and required sqliteDbPath under the <appSettings> node:

<appSettings>
    <add key="serilog:using:SQLite" value="Serilog.Sinks.SQLite"/>
    <add key="serilog:write-to:SQLite.sqliteDbPath" value="Logs\log.db"/>
    <add key="serilog:write-to:SQLite.tableName" value="Logs"/>
    <add key="serilog:write-to:SQLite.storeTimestampInUtc" value="true"/>
</appSettings>    

Performance

SQLite sink automatically buffers log internally and flush to SQLite database in batches on dedicated thread.

Build status

serilog-sinks-sqlite's People

Contributors

saleem-mirza avatar noahsurprenant avatar kravlost avatar dahovey avatar exp10der avatar spoland avatar aniket-sixmod5 avatar ayauka avatar yoandydt avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.