Skip to content

Commit e20134f

Browse files
author
raymond
committed
release 1.0.0
1 parent c3626dc commit e20134f

File tree

3 files changed

+15
-19
lines changed

3 files changed

+15
-19
lines changed

src/Serilog.Sinks.Aliyun/Serilog.Sinks.Aliyun.csproj

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFrameworks>netstandard2.0;net6.0;net7.0</TargetFrameworks>
4+
<TargetFrameworks>net6.0;net8.0</TargetFrameworks>
55
<ImplicitUsings>enable</ImplicitUsings>
66
<Nullable>enable</Nullable>
7-
<Version>0.2.0</Version>
7+
<Version>1.0.0</Version>
88
<NoWarn>$(NoWarn);CS1591</NoWarn>
99
<RootNamespace/>
1010
<LangVersion>latest</LangVersion>
@@ -30,8 +30,7 @@
3030
<ItemGroup>
3131
<PackageReference Include="Newtonsoft.Json" Version="$(NewtonsoftJsonVersion)"/>
3232
<PackageReference Include="Aliyun.Api.LogService" Version="$(AliyunApiLogServiceVersion)"/>
33-
<PackageReference Include="Serilog" Version="$(SerilogVersion)"/>
34-
<PackageReference Include="Serilog.Sinks.PeriodicBatching" Version="$(SerilogSinksPeriodicBatchingVersion)"/>
33+
<PackageReference Include="Serilog" Version="4.0.0" />
3534
</ItemGroup>
3635

3736
<ItemGroup>

src/Serilog.Sinks.Aliyun/Serilog/SeqLoggerConfigurationExtensions.cs

+3-6
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
using Serilog.Events;
44
using Serilog.Sinks.Aliyun;
55
using Serilog.Sinks.Aliyun.Batched;
6-
using Serilog.Sinks.PeriodicBatching;
76

87
namespace Serilog
98
{
@@ -70,18 +69,16 @@ public static LoggerConfiguration Aliyun(
7069
source,
7170
requestTimeout);
7271

73-
var options = new PeriodicBatchingSinkOptions
72+
var options = new BatchingOptions
7473
{
7574
BatchSizeLimit = batchPostingLimit,
76-
Period = defaultedPeriod,
75+
BufferingTimeLimit = defaultedPeriod,
7776
QueueLimit = queueSizeLimit
7877
};
7978

80-
var sink = new PeriodicBatchingSink(batchedSink, options);
81-
8279
return loggerSinkConfiguration.Conditional(
8380
controlledSwitch.IsIncluded,
84-
wt => wt.Sink(sink, restrictedToMinimumLevel, levelSwitch: null));
81+
wt => wt.Sink(batchedSink, options, restrictedToMinimumLevel, levelSwitch: null));
8582
}
8683
}
8784
}

src/Serilog.Sinks.Aliyun/Serilog/Sinks/Aliyun/Batched/BatchedAliyunSink.cs

+9-9
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
using Aliyun.Api.LogService;
22
using Aliyun.Api.LogService.Domain.Log;
33
using Aliyun.Api.LogService.Infrastructure.Protocol.Http;
4+
using Serilog.Core;
45
using Serilog.Debugging;
56
using Serilog.Events;
6-
using Serilog.Sinks.PeriodicBatching;
77

88
namespace Serilog.Sinks.Aliyun.Batched;
99

1010
/// <summary>
11-
/// The default Aliyun sink, for use in combination with <see cref="PeriodicBatchingSink"/>.
11+
/// The default Aliyun sink
1212
/// </summary>
1313
public sealed class BatchedAliyunSink : IBatchedLogEventSink
1414
{
@@ -37,15 +37,10 @@ public BatchedAliyunSink(string accessKeyId,
3737
}
3838

3939

40-
public Task OnEmptyBatchAsync()
41-
{
42-
return Task.CompletedTask;
43-
}
44-
45-
public async Task EmitBatchAsync(IEnumerable<LogEvent> events)
40+
public async Task EmitBatchAsync(IReadOnlyCollection<LogEvent> batch)
4641
{
4742
var logs = new List<LogInfo>();
48-
foreach (var logEvent in events)
43+
foreach (var logEvent in batch)
4944
{
5045
var log = new LogInfo
5146
{
@@ -88,4 +83,9 @@ public async Task EmitBatchAsync(IEnumerable<LogEvent> events)
8883
SelfLog.WriteLine(response.Error.ErrorMessage);
8984
}
9085
}
86+
87+
public Task OnEmptyBatchAsync()
88+
{
89+
return Task.CompletedTask;
90+
}
9191
}

0 commit comments

Comments
 (0)