54 lines
1.7 KiB
C#
54 lines
1.7 KiB
C#
using AyCode.Core.Enums;
|
|
using AyCode.Core.Loggers;
|
|
using AyCode.Entities;
|
|
using AyCode.Entities.LogItems;
|
|
using AyCode.Interfaces.Entities;
|
|
using static System.Net.WebRequestMethods;
|
|
using System;
|
|
|
|
namespace AyCode.Services.Loggers;
|
|
|
|
public abstract class AcHttpClientLogItemWriter<TLogItem> : AcLogItemWriterBase<TLogItem> where TLogItem : class, IAcLogItemClient
|
|
{
|
|
protected HttpClient _httpClient;
|
|
protected readonly HttpClientHandler _httpClientHandler;
|
|
|
|
protected AcHttpClientLogItemWriter(HttpClient httpClient) : base(AppType.Web, LogLevel.Detail)
|
|
{
|
|
_httpClient = httpClient;
|
|
}
|
|
|
|
protected AcHttpClientLogItemWriter(string? categoryName = null) : base(categoryName)
|
|
{
|
|
_httpClientHandler = new HttpClientHandler();
|
|
_httpClient = new HttpClient(_httpClientHandler, false);
|
|
}
|
|
|
|
protected AcHttpClientLogItemWriter(AppType appType, LogLevel logLevel, string? categoryName = null) : base(appType, logLevel, categoryName)
|
|
{
|
|
_httpClientHandler = new HttpClientHandler();
|
|
_httpClient = new HttpClient(_httpClientHandler, false);
|
|
}
|
|
|
|
|
|
//protected override void WriteLogItem(TLogItem logItem, Action? callback = null)
|
|
//{
|
|
// //throw new NotImplementedException();
|
|
|
|
// base.WriteLogItem(logItem, () =>
|
|
// {
|
|
// //http.PostAsJson(url, Param);
|
|
// //_httpClient.Send()
|
|
// });
|
|
//}
|
|
|
|
//protected override void WriteLogItem(TLogItem logItem, Action<IEnumerable<TLogItem>>? callback = null)
|
|
//{
|
|
// throw new NotImplementedException();
|
|
|
|
// base.WriteLogItem(logItem, logItems =>
|
|
// {
|
|
// //_httpClient.Send()
|
|
// });
|
|
//}
|
|
} |