Coder Social home page Coder Social logo

ecampidoglio / serilog-sinks-fastconsole Goto Github PK

View Code? Open in Web Editor NEW

This project forked from manigandham/serilog-sinks-fastconsole

0.0 0.0 0.0 119 KB

Serilog sink that writes to console with high-performance non-blocking output.

License: MIT License

C# 99.19% Batchfile 0.81%

serilog-sinks-fastconsole's Introduction

Serilog.Sinks.FastConsole

Serilog sink that writes to console with high-performance non-blocking output. Supports plaintext and JSON output but does not support themes and colors.

This sink uses a background channel with a single reader, efficient text buffer, and asynchronous writes to remove all blocking and lock contention to the console output stream. It also implements IDiposable so calling Log.CloseAndFlush() will ensure all lines are flushed.

Recommended for high-volume logging where console output is collected or redirected to another system, for example this library was originally created for large application clusters running in Kubernetes and logging hundreds of JSON objects every second.

  • Built for net6.0, netstandard2.1, netstandard2.0
  • Release notes here: CHANGELOG.md

Getting started

dotnet add package Serilog.Sinks.FastConsole

Configure Logger (using code):

var config = new FastConsoleSinkOptions { UseJson = true };
Log.Logger = new LoggerConfiguration().WriteTo.FastConsole(config).CreateLogger();

Sink Options

Name Default Description
UseJson true Enable to write log events as a JSON object with { timestamp, level, message, properties } structure. Provide an ITextFormatter implementation instead to customize the output completely.
QueueLimit null Set max limit for the number of log entries queued in memory. Used to provide backpressure and avoid out-of-memory issues for high-volume logging.
BlockWhenFull false Set behavior when queue is full. When true this will block the thread until logs are output to console. Only applicable if QueueLimit is set.

serilog-sinks-fastconsole's People

Contributors

manigandham avatar sungam3r avatar astryia 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.