Code Monkey home page Code Monkey logo

rebus.serilog's Introduction

Rebus.Serilog

install from nuget

Provides a Serilog logging integration for Rebus.


Do it like this if you just want Rebus to use your global Serilog logger directly:

Configure.With(...)
	.Logging(l => l.Serilog())
	.Transport(t => t.Use(...))
	.(...)
	.Start();

or like this if you want to customize it:

var logger = Log.ForContext("queue", queueName);

Configure.With(...)
	.Logging(l => l.Serilog(logger))
	.Transport(t => t.Use(..., queueName))
	.(...)
	.Start();

Initialize your Serilog logging with Rebus' correlation ID enricher if you'd like the correlation ID of handled messages to be added automatically to all log output generated from message handlers:

Log.Logger = new LoggerConfiguration()
    .WriteTo.(...)
    .Enrich.WithRebusCorrelationId("CorrelationId")
    .CreateLogger();

and then either use real structured logging (e.g. to an aggregator like Elastic), or remember to include it in your output template (here shown with ColoredConsole):

//                                                                                  ๐Ÿ‘‡
Log.Logger = new LoggerConfiguration()
	.WriteTo.ColoredConsole(outputTemplate: "{Timestamp:HH:mm:ss} {Level:u3} ({CorrelationId}) {Message}{NewLine}{Exception}")
	.(...)

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.