Skip to content

Commit a510f7d

Browse files
committed
feat: add new pipeline
1 parent b39b2f5 commit a510f7d

File tree

3 files changed

+51
-18
lines changed

3 files changed

+51
-18
lines changed
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Package Distribution
2+
3+
on:
4+
push:
5+
tags:
6+
- v*
7+
pull_request:
8+
branches:
9+
- main
10+
11+
jobs:
12+
build:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v4
16+
17+
- name: Setup .NET 9
18+
uses: actions/setup-dotnet@v4
19+
with:
20+
dotnet-version: 9.0.*
21+
22+
- name: Restore dotnet
23+
run: dotnet restore
24+
25+
- name: Build dotnet
26+
run: dotnet build --no-restore
27+
28+
- name: Docker meta
29+
id: meta
30+
uses: docker/metadata-action@v5
31+
with:
32+
sep-tags: ";"
33+
tags: |
34+
type=schedule
35+
type=ref,event=branch
36+
type=ref,event=pr
37+
type=semver,pattern={{version}}
38+
39+
- name: Pack .NET project
40+
run: dotnet pack src/Intility.Logging -o Intility.Logging/output --no-build --property:TreatWarningsAsErrors=true --property:Version=${{ steps.meta.outputs.tags }}
41+
42+
- name: Publish to NuGet
43+
run: dotnet nuget push Intility.Logging/output/*.nupkg --skip-duplicate --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json

src/Intility.Extensions.Logging.Elasticsearch/LoggerBuilderExtensions.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
using Elastic.Ingest.Elasticsearch.DataStreams;
44
using Elastic.Serilog.Sinks;
55
using Elastic.Transport;
6-
using Microsoft.Extensions.Options;
76
using Serilog.Debugging;
87
using System;
98
using System.Linq;
@@ -72,17 +71,18 @@ public static ILoggerBuilder UseElasticsearch(this ILoggerBuilder builder, strin
7271
{
7372
DataStream = new DataStreamName(indexFormat, dataSet, namespaceName),
7473
BootstrapMethod = BootstrapMethod.Silent,
75-
ChannelDiagnosticsCallback = channel => {
74+
ChannelDiagnosticsCallback = channel =>
75+
{
7676
SelfLog.WriteLine(
7777
$"Failure={channel.PublishSuccess}, " +
7878
$"Message={channel}, " +
7979
$"Exception={channel.ObservedException}"
80-
);
80+
);
8181
},
8282
TextFormatting = new EcsTextFormatterConfiguration()
8383
};
8484

85-
if(!string.IsNullOrWhiteSpace(llmPolicy))
85+
if (!string.IsNullOrWhiteSpace(llmPolicy))
8686
{
8787
sinkOptions.IlmPolicy = llmPolicy;
8888
}

src/Intility.Extensions.Logging/LoggerBuilder.cs

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,13 @@
33

44
namespace Intility.Extensions.Logging
55
{
6-
public class LoggerBuilder : ILoggerBuilder
6+
public class LoggerBuilder(HostBuilderContext host, LoggerConfiguration config, IHostBuilder hostBuilder) : ILoggerBuilder
77
{
8-
private readonly HostBuilderContext _host;
9-
private readonly LoggerConfiguration _config;
10-
private readonly IHostBuilder _hostBuilder;
118
public ConsoleFormat ConsoleFormat { get; private set; } = ConsoleFormat.Pretty;
129

13-
public LoggerBuilder(HostBuilderContext host, LoggerConfiguration config, IHostBuilder hostBuilder)
14-
{
15-
_host = host;
16-
_config = config;
17-
_hostBuilder = hostBuilder;
18-
}
19-
20-
public HostBuilderContext Host => _host;
21-
public IHostBuilder HostBuilder => _hostBuilder;
22-
public LoggerConfiguration Configuration => _config;
10+
public HostBuilderContext Host => host;
11+
public IHostBuilder HostBuilder => hostBuilder;
12+
public LoggerConfiguration Configuration => config;
2313

2414
public ILoggerBuilder UseConsoleFormat(ConsoleFormat format)
2515
{

0 commit comments

Comments
 (0)