Seriolog

Редактировал(а) Alexandr Fokin 2023/12/17 12:11

Seriologhttps://serilog.net
https://github.com/serilog/serilog
 Структурированное логирование
 

Структурное логирование на примере Serilog и Seq
https://habr.com/ru/articles/266299/

Structured logging with Serilog and Seq and ElasticSearch under Docker
https://dev.to/hasdrubal/structure-logging-with-serilog-and-seq-and-elasticsearch-under-docker-16dk

 
Интеграция с Microsoft. Extensions. LoggingSerilog. Extensions. Logging
https://github.com/serilog/serilog-extensions-logging
 
Open Searchvar seriologConf = new LoggerConfiguration()
    .Enrich
    .FromLogContext();

seriologConf.WriteTo.OpenSearch(
    options: new OpenSearchSinkOptions(
       new Uri("https://<ip>:<port>")
        )
    {
        ModifyConnectionSettings = (s) =>
        {
            s
                .BasicAuthentication("admin", "admin")
                .EnableDebugMode(
                    e =>
                    {
                       //breakpoint
                   }                                    
                    )
                .ThrowExceptions(true)
                .ServerCertificateValidationCallback(static (_,_,_,_) => true);

           return s;
        }
    }
    );

logger = seriologConf.CreateLogger();
SeqSerilog. Sinks. Seq
https://github.com/datalust/serilog-sinks-seq
var seriologConf = new LoggerConfiguration();

seriologConf.WriteTo.Seq(serverUrl: "http://<url>", apiKey: "<key>");

logger = seriologConf.CreateLogger();

 

Теги:
Создал(а) Alexandr Fokin 2023/10/08 09:57