Лог и трассировка - Seriolog 

Page / - Изменено Alexandr Fokin в 2023/10/08 09:57 

Seriolog 
Изменено Alexandr Fokin
в 2023/10/08 09:57

Оглавление

Seriolog	https://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. Logging	Serilog. Extensions. Logging
https://github.com/serilog/serilog-extensions-logging	 	
Open Search	Serilog. Sinks. OpenSearch
https://github.com/villejuhanilaakso/serilog-sinks-opensearch
OpenSearch for .NET	var 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();	
Seq	Serilog. Sinks. Seq
https://github.com/datalust/serilog-sinks-seq	var seriologConf = new LoggerConfiguration();

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

logger = seriologConf.CreateLogger();