Skip to content

Commit

Permalink
release 1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
raymond committed Jun 17, 2024
1 parent c3626dc commit e20134f
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 19 deletions.
7 changes: 3 additions & 4 deletions src/Serilog.Sinks.Aliyun/Serilog.Sinks.Aliyun.csproj
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netstandard2.0;net6.0;net7.0</TargetFrameworks>
<TargetFrameworks>net6.0;net8.0</TargetFrameworks>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Version>0.2.0</Version>
<Version>1.0.0</Version>
<NoWarn>$(NoWarn);CS1591</NoWarn>
<RootNamespace/>
<LangVersion>latest</LangVersion>
Expand All @@ -30,8 +30,7 @@
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="$(NewtonsoftJsonVersion)"/>
<PackageReference Include="Aliyun.Api.LogService" Version="$(AliyunApiLogServiceVersion)"/>
<PackageReference Include="Serilog" Version="$(SerilogVersion)"/>
<PackageReference Include="Serilog.Sinks.PeriodicBatching" Version="$(SerilogSinksPeriodicBatchingVersion)"/>
<PackageReference Include="Serilog" Version="4.0.0" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
using Serilog.Events;
using Serilog.Sinks.Aliyun;
using Serilog.Sinks.Aliyun.Batched;
using Serilog.Sinks.PeriodicBatching;

namespace Serilog
{
Expand Down Expand Up @@ -70,18 +69,16 @@ public static LoggerConfiguration Aliyun(
source,
requestTimeout);

var options = new PeriodicBatchingSinkOptions
var options = new BatchingOptions
{
BatchSizeLimit = batchPostingLimit,
Period = defaultedPeriod,
BufferingTimeLimit = defaultedPeriod,
QueueLimit = queueSizeLimit
};

var sink = new PeriodicBatchingSink(batchedSink, options);

return loggerSinkConfiguration.Conditional(
controlledSwitch.IsIncluded,
wt => wt.Sink(sink, restrictedToMinimumLevel, levelSwitch: null));
wt => wt.Sink(batchedSink, options, restrictedToMinimumLevel, levelSwitch: null));
}
}
}
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
using Aliyun.Api.LogService;
using Aliyun.Api.LogService.Domain.Log;
using Aliyun.Api.LogService.Infrastructure.Protocol.Http;
using Serilog.Core;
using Serilog.Debugging;
using Serilog.Events;
using Serilog.Sinks.PeriodicBatching;

namespace Serilog.Sinks.Aliyun.Batched;

/// <summary>
/// The default Aliyun sink, for use in combination with <see cref="PeriodicBatchingSink"/>.
/// The default Aliyun sink
/// </summary>
public sealed class BatchedAliyunSink : IBatchedLogEventSink
{
Expand Down Expand Up @@ -37,15 +37,10 @@ public BatchedAliyunSink(string accessKeyId,
}


public Task OnEmptyBatchAsync()
{
return Task.CompletedTask;
}

public async Task EmitBatchAsync(IEnumerable<LogEvent> events)
public async Task EmitBatchAsync(IReadOnlyCollection<LogEvent> batch)
{
var logs = new List<LogInfo>();
foreach (var logEvent in events)
foreach (var logEvent in batch)
{
var log = new LogInfo
{
Expand Down Expand Up @@ -88,4 +83,9 @@ public async Task EmitBatchAsync(IEnumerable<LogEvent> events)
SelfLog.WriteLine(response.Error.ErrorMessage);
}
}

public Task OnEmptyBatchAsync()
{
return Task.CompletedTask;
}
}

0 comments on commit e20134f

Please sign in to comment.