GithubHelp home page GithubHelp logo

r-alekseev / profiler.serilog Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 21 KB

Serilog writers for Profiler (https://github.com/r-alekseev/Profiler)

License: MIT License

C# 100.00%
dotnet profiler performance serilog

profiler.serilog's Introduction

Profiler.Serilog

Profiler is minimalistic and fast profiling library for .NET

Serilog is simple .NET logging project with fully-structured events

This project contains components and configurations that provide the ability to write profiling traces and reports to structured events in Serilog.

Configuration

Serilog

Configuration basics: https://github.com/serilog/serilog/wiki/Configuration-Basics

Provided sinks: https://github.com/serilog/serilog/wiki/Provided-Sinks

Just an example of configuring a logger to a JSON text file and to the console.

var logger = new LoggerConfiguration()
    .MinimumLevel.Verbose()
    .WriteTo.File(new CompactJsonFormatter(), "log.txt")
    .WriteTo.Console()
    .CreateLogger();

Just another example of configuring a logger to the Elasticsearch index.

var logger = new LoggerConfiguration()
    .Enrich.WithExceptionDetails()
    .WriteTo.Elasticsearch(
        nodeUris: "http://some-address:9200",
        indexFormat: "some-service-{0:yyyy.MM.dd}",
        autoRegisterTemplate: true)
    .CreateLogger();

Profiler

Trace Writer

Call UseSerilogTraceWriter method for set up writing trace to Serilog.

Pass an instance of the logger configured above to UseLogger method.

var profiler = new ProfilerConfiguration()
    .UseSerilogTraceWriter(settings => settings
        .UseLogEventLevel(LogEventLevel.Verbose)
        .UseLogger(logger))
    .CreateProfiler();

Report Writer

Call UseSerilogReportWriter method for set up writing metrics report to Serilog.

Pass an instance of the logger configured above to UseLogger method.

var profiler = new ProfilerConfiguration()
    .UseSerilogReportWriter(settings => settings
        .UseLogEventLevel(LogEventLevel.Information)
        .UseLogger(logger))
    .CreateProfiler();

profiler.serilog's People

Watchers

 avatar

profiler.serilog's Issues

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.