예제 #1
0
        public NebuLogger(NebuLogOption nebulogOption, string categoryName)
        {
            _option       = nebulogOption;
            _categoryName = categoryName;

            _connection = new HubConnectionBuilder()
                          .WithUrl(_option.NebuLogHubUrl, httpconnectionoptions =>
            {
                httpconnectionoptions.HttpMessageHandlerFactory = (handler) =>
                {
                    var newHandler = handler as HttpClientHandler;
                    newHandler.ServerCertificateCustomValidationCallback = (request, cert, chain, errors) =>
                    {
                        return(true);
                    };
                    return(newHandler);
                };
            })
                          // Frank 2020.09.07 已过时:asp.net core 2.2
                          //.AddJsonProtocol()
                          //--- ASP.NET CORE 3.0
                          //.AddJsonProtocol()
                          .AddMessagePackProtocol()
                          .Build();

            _connection.Closed += async(error) =>
            {
                await Task.Delay(2000);

                await _connection.StartAsync();
            };
            _connection.StartAsync().Wait();
            //Console.WriteLine("==============Nebulog init==============");
        }
예제 #2
0
 public NebuLogger(NebuLogOption nebulogOption, HubConnection hubConnection, string categoryName)
 {
     _option       = nebulogOption;
     _connection   = hubConnection;
     _categoryName = categoryName;
 }
예제 #3
0
 public NebuLogProvider(IOptions <NebuLogOption> option)
 {
     _option = option.Value;
 }
예제 #4
0
 public NebuLogWpfProvider(NebuLogOption nebulogOption, HubConnection hubConnection)
 {
     _option     = nebulogOption;
     _connection = hubConnection;
 }
예제 #5
0
 public static void UseNebuLogWpf <T>(this ILoggerFactory factory, NebuLogOption nebulogOption, HubConnection hubConnection)
 {
     factory.AddProvider(new NebuLogWpfProvider(nebulogOption, hubConnection));
 }