Skip to content

Commit b3c6738

Browse files
committed
Fixes serilog-contrib/Serilog.Sinks.Postgresql.Alternative#83, updates NuGet packages, deprecates failureCallback.
1 parent abdba34 commit b3c6738

File tree

6 files changed

+22
-11
lines changed

6 files changed

+22
-11
lines changed

Changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
Change history
22
--------------
33

4+
* **Version 1.5.0.0 (2025-03-24)** : Fixes https://github.com/serilog-contrib/Serilog.Sinks.Postgresql.Alternative/issues/83, updates NuGet packages, deprecates `failureCallback`.
45
* **Version 1.4.3.0 (2024-12-02)** : Removed support for Net6.0, added support for Net9.0, updated NuGet packages, removed message splitting for large messages (Doesn't work well with HTML formatting), fixes https://github.com/serilog-contrib/Serilog.Sinks.Telegram.Alternative/issues/33.
56
* **Version 1.4.2.0 (2024-05-16)** : Removed support for Net7.0.
67
* **Version 1.4.1.0 (2024-03-03)**: Updated NuGet packages.

HowToUse.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ The project can be found on [nuget](https://www.nuget.org/packages/Serilog.Sinks
2222
|minimumLogEventLevel|The minimum level of the logging.|`minimumLogEventLevel: LogEventLevel.Verbose`|`LogEventLevel.Verbose`|
2323
|sendBatchesAsSingleMessages|A value indicating whether the batches are sent as single messages or as one block of messages.|`false`|`true`|
2424
|includeStackTrace|A value indicating whether the stack trace should be shown or not.|`false`|`true`|
25-
|failureCallback|Adds an option to add a failure callback action.|`failureCallback: e => Console.WriteLine($"Sink error: {e.Message}")`|`null`|
25+
|~~failureCallback~~|~~Adds an option to add a failure callback action.~~ (Deprecated, use fallback logging instead.Check https://nblumhardt.com/2024/10/fallback-logging/.)|~~`failureCallback: e => Console.WriteLine($"Sink error: {e.Message}")`~~|~~`null`~~|
2626
|useCustomHtmlFormatting|An option to allow custom HTML formatting inside the message text and the application name (Use only if really needed). Make sure to use the HTML formatting from https://core.telegram.org/bots/api#html-style.|`true`|`false`|
2727
|botApiUrl|A custom bot API url.|`https://telegram.something.com/bot`|`https://api.telegram.org/bot`|
2828
|outputTemplate|A custom output template following the Serilog standard. Check https://github.com/serilog/serilog/wiki/Formatting-Output.|`"[{Timestamp:HH:mm:ss} {Level:u3}] {Message:lj}{NewLine}{Exception}"`|`null`|

src/Serilog.Sinks.Telegram.Alternative.Tests/Serilog.Sinks.Telegram.Alternative.Tests.csproj

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@
1111
</PropertyGroup>
1212

1313
<ItemGroup>
14-
<PackageReference Include="GitVersion.MsBuild" Version="6.0.5">
14+
<PackageReference Include="GitVersion.MsBuild" Version="6.1.0">
1515
<PrivateAssets>all</PrivateAssets>
1616
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
1717
</PackageReference>
18-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
19-
<PackageReference Include="MSTest.TestAdapter" Version="3.6.3" />
20-
<PackageReference Include="MSTest.TestFramework" Version="3.6.3" />
21-
<PackageReference Include="coverlet.collector" Version="6.0.2">
18+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.13.0" />
19+
<PackageReference Include="MSTest.TestAdapter" Version="3.8.3" />
20+
<PackageReference Include="MSTest.TestFramework" Version="3.8.3" />
21+
<PackageReference Include="coverlet.collector" Version="6.0.4">
2222
<PrivateAssets>all</PrivateAssets>
2323
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
2424
</PackageReference>

src/Serilog.Sinks.Telegram.Alternative/Serilog.Sinks.Telegram.Alternative.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
<RepositoryUrl>https://github.com/serilog-contrib/Serilog.Sinks.Telegram.Alternative</RepositoryUrl>
1717
<PackageIcon>Icon.png</PackageIcon>
1818
<RepositoryType>Github</RepositoryType>
19-
<PackageReleaseNotes>Version 1.4.3.0 (2024-12-02): Removed support for Net6.0, added support for Net9.0, updated NuGet packages, removed message splitting for large messages (Doesn't work well with HTML formatting), fixes https://github.com/serilog-contrib/Serilog.Sinks.Telegram.Alternative/issues/33.</PackageReleaseNotes>
19+
<PackageReleaseNotes>Version 1.5.0.0 (2025-03-24): Fixes https://github.com/serilog-contrib/Serilog.Sinks.Postgresql.Alternative/issues/83, updates NuGet packages, deprecates `failureCallback`.</PackageReleaseNotes>
2020
<PackageLicenseExpression>MIT</PackageLicenseExpression>
2121
<LangVersion>latest</LangVersion>
2222
<Nullable>enable</Nullable>
@@ -31,13 +31,13 @@
3131
</PropertyGroup>
3232

3333
<ItemGroup>
34-
<PackageReference Include="GitVersion.MsBuild" Version="6.0.5">
34+
<PackageReference Include="GitVersion.MsBuild" Version="6.1.0">
3535
<PrivateAssets>all</PrivateAssets>
3636
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
3737
</PackageReference>
3838
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" PrivateAssets="All" />
3939
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
40-
<PackageReference Include="Serilog" Version="4.1.0" />
40+
<PackageReference Include="Serilog" Version="4.2.0" />
4141
<PackageReference Include="System.Net.Http" Version="4.3.4" />
4242
<PackageReference Include="Serilog.Sinks.PeriodicBatching" Version="5.0.0" />
4343
</ItemGroup>

src/Serilog.Sinks.Telegram.Alternative/Sinks/Telegram/Alternative/TelegramSink.cs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,8 +226,11 @@ private async Task SendMessage(HttpClient httpClient, string? botApiUrl, string
226226
}
227227
catch (Exception ex)
228228
{
229-
SelfLog.WriteLine($"{ex.Message} {ex.StackTrace}");
229+
#pragma warning disable CS0618 // Typ oder Element ist veraltet
230+
// Todo: Remove this in next version!
230231
this.options.FailureCallback?.Invoke(ex);
232+
#pragma warning restore CS0618 // Typ oder Element ist veraltet
233+
throw;
231234
}
232235
}
233236

@@ -244,8 +247,11 @@ private void TryWriteToSelflog(string messageTemplate)
244247
}
245248
catch (Exception ex)
246249
{
247-
SelfLog.WriteLine($"{ex.Message} {ex.StackTrace}");
250+
#pragma warning disable CS0618 // Typ oder Element ist veraltet
251+
// Todo: Remove this in next version!
248252
this.options.FailureCallback?.Invoke(ex);
253+
#pragma warning restore CS0618 // Typ oder Element ist veraltet
254+
throw;
249255
}
250256
}
251257
}

src/Serilog.Sinks.Telegram.Alternative/Sinks/Telegram/Alternative/TelegramSinkOptions.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,10 @@ public TelegramSinkOptions(
8080
this.MinimumLogEventLevel = minimumLogEventLevel;
8181
this.SendBatchesAsSingleMessages = sendBatchesAsSingleMessages ?? true;
8282
this.IncludeStackTrace = includeStackTrace ?? true;
83+
#pragma warning disable CS0618 // Typ oder Element ist veraltet
84+
// Todo: Remove this in next version!
8385
this.FailureCallback = failureCallback;
86+
#pragma warning restore CS0618 // Typ oder Element ist veraltet
8487
this.DateFormat = dateFormat;
8588
this.ApplicationName = applicationName;
8689
this.UseCustomHtmlFormatting = useCustomHtmlFormatting;
@@ -152,6 +155,7 @@ public TelegramSinkOptions(
152155
/// <summary>
153156
/// Gets the failure callback.
154157
/// </summary>
158+
[Obsolete("Use fallback logging instead. Check https://nblumhardt.com/2024/10/fallback-logging/.")]
155159
public Action<Exception>? FailureCallback { get; }
156160

157161
/// <summary>

0 commit comments

Comments
 (0)