serilog/serilog (Serilog)
### [`v4.1.0`](https://redirect.github.com/serilog/serilog/releases/tag/v4.1.0)
- [#2108](https://redirect.github.com/serilog/serilog/issues/2108) - failure listeners and fallback sinks ([@nblumhardt](https://redirect.github.com/nblumhardt))
- [#2120](https://redirect.github.com/serilog/serilog/issues/2120) - add `BatchingOptions.RetryTimeLimit` and [update retry scheduling algorithm](https://nblumhardt.com/2024/10/retry-time-limit/) ([@nblumhardt](https://redirect.github.com/nblumhardt))
#### Important note
`IBatchedLogEventSink` batch retry scheduling has changed in this version. The default configuration still tries failed batches for approximately ten minutes, but the `BufferingTimeLimit` no longer implicitly causes the retry time to be extended or reduced. If you need a specific retry time, set `BatchingOptions.RetryTimeLimit`, which reliably controls retry time.
### [`v4.0.2`](https://redirect.github.com/serilog/serilog/releases/tag/v4.0.2)
- [#2094](https://redirect.github.com/serilog/serilog/issues/2094) - remove boxing and string allocations in output template formatting ([@epeshk](https://redirect.github.com/epeshk))
- [#2103](https://redirect.github.com/serilog/serilog/issues/2103) - don't capture properties with private `get` accessors ([@nblumhardt](https://redirect.github.com/nblumhardt))
- [#2095](https://redirect.github.com/serilog/serilog/issues/2095) - remove junk file ([@Numpsy](https://redirect.github.com/Numpsy))
- [#2116](https://redirect.github.com/serilog/serilog/issues/2116) - fall back to `IDisposable` in `Log.CloseAndFlushAsync()` when the target logger is not `IAsyncDisposable` ([@nblumhardt](https://redirect.github.com/nblumhardt))
### [`v4.0.1`](https://redirect.github.com/serilog/serilog/releases/tag/v4.0.1)
- [#2090](https://redirect.github.com/serilog/serilog/issues/2090) — when capturing structured values, reuse `HashSet` instances, reduce LINQ usage, avoid reallocating `string[]` to improve performance and cut GC pressure ([@nblumhardt](https://redirect.github.com/nblumhardt))
- [#2089](https://redirect.github.com/serilog/serilog/issues/2089) - allow capturing of non-anonymous structured values when trimming ([@nblumhardt](https://redirect.github.com/nblumhardt))
- [#2083](https://redirect.github.com/serilog/serilog/issues/2083) - use `Major.Minor.0.0` assembly versioning ([@nblumhardt](https://redirect.github.com/nblumhardt))
### [`v4.0.0`](https://redirect.github.com/serilog/serilog/releases/tag/v4.0.0)
#### What's new in Serilog 4.0.0?
> If you're deploying to .NET Framework, note that Serilog's **assembly version** number has [been unpinned](https://redirect.github.com/serilog/serilog/issues/2015) from the long-running historical `2.0.0` default, and now matches the package version precisely. If you encounter issues, ensure your build is generating valid assembly binding redirects.
##### Simple, robust, built-in batching support
Sinks that need batching functionality [can now be easily written](https://redirect.github.com/serilog/serilog/issues/2055), without any additional package dependencies, by implementing `IBatchedLogEventSink`:
```csharp
class MyBatchedSink: IBatchedLogEventSink
{
public Task EmitBatchAsync(IReadOnlyCollection batch)
{
// Send a batch of log events...
}
}
```
Batched sinks can be added using `WriteTo.Sink(IBatchedLogEventSink, ...)` - they're given first-class consideration just like regular un-batched sinks.
The built-in batching implementation is based on `System.Threading.Channels` and draws on the original `Serilog.Sinks.PeriodicBatching` package (now in maintenance-mode), to provide a full-featured, efficient, async-native batching implementation.
##### Experimental dotted name capturing
By setting an experimental `AppContext` switch, message templates [can be used](https://redirect.github.com/serilog/serilog/issues/2063) to capture dotted names, which are required when using some logging schemas.
```csharp
AppContext.SetSwitch("Serilog.Parsing.MessageTemplateParser.AcceptDottedPropertyNames", true);
Log.Information("Running as {user.name}", Environment.UserName);
// Captures {"user.name": "nblumhardt"}
```
While currently experimental and unsupported, this flag is intended to help the ecosystem evaluate and prepare for dotted name support in a future Serilog release.
#### Changes
- [#2015](https://redirect.github.com/serilog/serilog/issues/2015) — **breaking** unpin assembly version ([@nblumhardt](https://redirect.github.com/nblumhardt))
- [#2045](https://redirect.github.com/serilog/serilog/issues/2045) — **breaking** use case-insensitive matching for level overrides ([@tillig](https://redirect.github.com/tillig))
- [#2051](https://redirect.github.com/serilog/serilog/issues/2051) — **breaking** recognize `UtcTimestamp` as a built-in token in output templates ([@MatthewHays](https://redirect.github.com/MatthewHays))
- [#1979](https://redirect.github.com/serilog/serilog/issues/1979) — add tests for `ReusableStringWriter` ([@nblumhardt](https://redirect.github.com/nblumhardt))
- [#2016](https://redirect.github.com/serilog/serilog/issues/2016) — update TFMs ([@nblumhardt](https://redirect.github.com/nblumhardt), [@bartelink](https://redirect.github.com/bartelink))
- [#2018](https://redirect.github.com/serilog/serilog/issues/2018) — add `LogEvent.UnstableAssembleFromParts()` ([@nblumhardt](https://redirect.github.com/nblumhardt))
- [#2044](https://redirect.github.com/serilog/serilog/issues/2044) — build updates for compatibility ([@tillig](https://redirect.github.com/tillig))
- [#2027](https://redirect.github.com/serilog/serilog/issues/2027) — improve trimming annotations, compatibility switch for compiler-generated type support ([@agocke](https://redirect.github.com/agocke))
- [#2055](https://redirect.github.com/serilog/serilog/issues/2055) — introduce `IBatchedLogEventSink` and `WriteTo.Sink(IBatchedLogEventSink)` ([@nblumhardt](https://redirect.github.com/nblumhardt))
- [#2060](https://redirect.github.com/serilog/serilog/issues/2060) — introduce `LoggerSinkConfiguration.CreateSink()` and redesign `.Wrap()` ([@nblumhardt](https://redirect.github.com/nblumhardt), [@bartelink](https://redirect.github.com/bartelink))
- [#2063](https://redirect.github.com/serilog/serilog/issues/2063) — improve `MessageTemplateParser` performance, switch to allow `.` in captured property names ([@nblumhardt](https://redirect.github.com/nblumhardt))
- [#2064](https://redirect.github.com/serilog/serilog/issues/2064) — make message template alignment parsing match spec ([@Insomniak47](https://redirect.github.com/Insomniak47))
- [#2065](https://redirect.github.com/serilog/serilog/issues/2065) — allow any character except `}` in message template format specifiers ([@Insomniak47](https://redirect.github.com/Insomniak47))
### [`v3.1.1`](https://redirect.github.com/serilog/serilog/releases/tag/v3.1.1)
- [#1977](https://redirect.github.com/serilog/serilog/issues/1977) - don't stack overflow when disposing `ReusableStringWriter` with large renderings ([@nblumhardt](https://redirect.github.com/nblumhardt))
This is a bugfix for [release 3.1.0](https://redirect.github.com/serilog/serilog/releases/tag/v3.1.0).
### [`v3.1.0`](https://redirect.github.com/serilog/serilog/releases/tag/v3.1.0)
- [#1935](https://redirect.github.com/serilog/serilog/issues/1935) - remove `CHANGES.md` ([@sungam3r](https://redirect.github.com/sungam3r))
- [#1936](https://redirect.github.com/serilog/serilog/issues/1936), [#1922](https://redirect.github.com/serilog/serilog/issues/1922) - `README.md` updates ([@nblumhardt](https://redirect.github.com/nblumhardt))
- [#1942](https://redirect.github.com/serilog/serilog/issues/1942) - remove redundant `GetTypeInfo()` calls ([@SimonCropp](https://redirect.github.com/SimonCropp))
- [#1947](https://redirect.github.com/serilog/serilog/issues/1947) - message template caching performance improvements ([@epeshk](https://redirect.github.com/epeshk))
- [#1948](https://redirect.github.com/serilog/serilog/issues/1948) - reduce allocations in `Logger.Write()` ([@epeshk](https://redirect.github.com/epeshk))
- [#1955](https://redirect.github.com/serilog/serilog/issues/1955) **breaking** - collect and propagate `Activity.Current.TraceId` and `SpanId` automatically in `Logger.Write()` ([@nblumhardt](https://redirect.github.com/nblumhardt))
- [#1959](https://redirect.github.com/serilog/serilog/issues/1959) - **breaking** - property value converter optimizations ([@epeshk](https://redirect.github.com/epeshk))
- [#1964](https://redirect.github.com/serilog/serilog/issues/1964) - don't cache reusable string writers with large buffer sizes ([@Jakimar](https://redirect.github.com/Jakimar))
- [#1969](https://redirect.github.com/serilog/serilog/issues/1969) - `README.md` updates ([@bartelink](https://redirect.github.com/bartelink))
- [#1971](https://redirect.github.com/serilog/serilog/issues/1971) - drop test coverage for unsupported .NET Core versions ([@bartelink](https://redirect.github.com/bartelink))
### Built-in trace and span id support
This release adds two new first-class properties to `LogEvent`: `TraceId` and `SpanId`. These are set automatically in `Logger.Write()` to the corresponding property values from `System.Diagnostics.Activity.Current`.
The major benefit of this change is that sinks, once updated, can reliably propagate trace and span ids through to back-ends that support them (in much the same way that first-class timestamps, messages, levels, and exceptions are used today).
The sinks maintained under `serilog/serilog`, along with formatting helpers such as *Serilog.Formatting.Compact* and *Serilog.Expressions*, are already compatible with this change or have pending releases that add compatibility.
#### Dropped .NET Core 2.1 and 3.0 support
On .NET Core 2.1 and 3.0, projects targeting Serilog 3.1+ will fail to build, with:
/project/packages/system.runtime.compilerservices.unsafe/6.0.0/buildTransitive/netcoreapp2.0
/System.Runtime.CompilerServices.Unsafe.targets(4,5): error : System.Runtime.CompilerServices.Unsafe
doesn't support netcoreapp2.1. Consider updating your TargetFramework to netcoreapp3.1 or later.
Affected consumers should continue to use Serilog 3.0 or earlier. See [https://github.com/serilog/serilog/issues/1983](https://redirect.github.com/serilog/serilog/issues/1983) for a discussion of this issue.
#### Technical breaking changes
##### Trace and span id placeholders
Trace and span id collection includes support for `{TraceId}` and `{SpanId}` placeholders in output templates (commonly used when formatting text log files). Where previously these names resolved to user-defined properties, they now resolve to the built-in `LogEvent.TraceId` and `LogEvent.SpanId` values, respectively.
Impact is expected to be low/zero, because the trace and span id values in any user-added properties are almost certainly identical to the built-in ones.
##### `nint` and `nuint` (`IntPtr` and `UIntPtr`) handling
These integer types were previously logged as structures. They're now correctly logged as scalars.
### [`v3.0.1`](https://redirect.github.com/serilog/serilog/releases/tag/v3.0.1)
- [#1926](https://redirect.github.com/serilog/serilog/issues/1926) - fix `JsonFormatter` output for `renderMessage = true` ([@nblumhardt](https://redirect.github.com/nblumhardt))
### [`v3.0.0`](https://redirect.github.com/serilog/serilog/releases/tag/v3.0.0)
#### What's new in 3.0.0?
**Target framework changes** - Serilog no longer targets `netstandard1.x` or .NET Framework versions earlier than .NET 4.6.2. Users on affected frameworks should continue to target Serilog 2.12.x.
**Removed obsolete APIs** - Many deprecated/obsolete types and functions have been removed. Notably, `JsonFormatter` can no longer be subclassed (either port to `JsonValueFormatter`, use *Serilog.Expressions*, or copy [the original `JsonFormatter` code](https://redirect.github.com/serilog/serilog/blob/4d13be50c03e14b6072043799dc7e5dbe4139a19/src/Serilog/Formatting/Json/JsonFormatter.cs) into your project).
**Added APIs** - `LevelAlias.Off` is now provided as an equivalent to *Microsoft.Extensions.Logging*'s `LogLevel.Off`; `Destructure.AsDictionary()` can now be used to mark dictionary types.
**Fewer allocations on many hot paths** - A lot of work has gone into avoiding heap allocations wherever possible.
#### Changes
- Change exception message by [@sungam3r](https://redirect.github.com/sungam3r) in [https://github.com/serilog/serilog/pull/1762](https://redirect.github.com/serilog/serilog/pull/1762)
- Avoided `IEnumerator` allocation ([#1769](https://redirect.github.com/serilog/serilog/issues/1769)) by [@igor84](https://redirect.github.com/igor84) in [https://github.com/serilog/serilog/pull/1770](https://redirect.github.com/serilog/serilog/pull/1770)
- Avoid iterator allocations when working with SequenceValue by [@sungam3r](https://redirect.github.com/sungam3r) in [https://github.com/serilog/serilog/pull/1785](https://redirect.github.com/serilog/serilog/pull/1785)
- Add API approval test by [@sungam3r](https://redirect.github.com/sungam3r) in [https://github.com/serilog/serilog/pull/1783](https://redirect.github.com/serilog/serilog/pull/1783)
- Bump Newtonsoft.Json from 13.0.1 to 13.0.2 in /test/Serilog.Tests by [@dependabot](https://redirect.github.com/dependabot) in [https://github.com/serilog/serilog/pull/1787](https://redirect.github.com/serilog/serilog/pull/1787)
- Introduce `ScalarValue.Null` by [@sungam3r](https://redirect.github.com/sungam3r) in [https://github.com/serilog/serilog/pull/1774](https://redirect.github.com/serilog/serilog/pull/1774)
- `Tokens` -> `TokenArray` by [@sungam3r](https://redirect.github.com/sungam3r) in [https://github.com/serilog/serilog/pull/1778](https://redirect.github.com/serilog/serilog/pull/1778)
- Drop `netstandard1.3` and `netstandard1.0` support by [@SimonCropp](https://redirect.github.com/SimonCropp) in [https://github.com/serilog/serilog/pull/1807](https://redirect.github.com/serilog/serilog/pull/1807)
- Remove `JsonFormatter.Escape` by [@SimonCropp](https://redirect.github.com/SimonCropp) in [https://github.com/serilog/serilog/pull/1804](https://redirect.github.com/serilog/serilog/pull/1804)
- Use `WriteLine(char)` by [@SimonCropp](https://redirect.github.com/SimonCropp) in [https://github.com/serilog/serilog/pull/1803](https://redirect.github.com/serilog/serilog/pull/1803)
- Remove extension of `JsonFormatter` by subclassing by [@SimonCropp](https://redirect.github.com/SimonCropp) in [https://github.com/serilog/serilog/pull/1801](https://redirect.github.com/serilog/serilog/pull/1801)
- Remove redundant overrides from `LoggerSinkConfiguration` by [@SimonCropp](https://redirect.github.com/SimonCropp) in [https://github.com/serilog/serilog/pull/1800](https://redirect.github.com/serilog/serilog/pull/1800)
- Avoid `StringWriter.ToString()` calls by [@sungam3r](https://redirect.github.com/sungam3r) in [https://github.com/serilog/serilog/pull/1782](https://redirect.github.com/serilog/serilog/pull/1782)
- Remove the obsolete `RawFormatter` type by [@nblumhardt](https://redirect.github.com/nblumhardt) in [https://github.com/serilog/serilog/pull/1808](https://redirect.github.com/serilog/serilog/pull/1808)
- .NET 7 SDK by [@SimonCropp](https://redirect.github.com/SimonCropp) in [https://github.com/serilog/serilog/pull/1806](https://redirect.github.com/serilog/serilog/pull/1806)
- Remove `OutputProperties.GetOutputProperties()` by [@SimonCropp](https://redirect.github.com/SimonCropp) in [https://github.com/serilog/serilog/pull/1805](https://redirect.github.com/serilog/serilog/pull/1805)
- Verify API by [@SimonCropp](https://redirect.github.com/SimonCropp) in [https://github.com/serilog/serilog/pull/1809](https://redirect.github.com/serilog/serilog/pull/1809)
- Remove redundant nullable suppressions by [@SimonCropp](https://redirect.github.com/SimonCropp) in [https://github.com/serilog/serilog/pull/1810](https://redirect.github.com/serilog/serilog/pull/1810)
- Remove duplicate `Where()` calls in `FindConfigurationMethods()` by [@SimonCropp](https://redirect.github.com/SimonCropp) in [https://github.com/serilog/serilog/pull/1812](https://redirect.github.com/serilog/serilog/pull/1812)
- Remove `net45` support by [@SimonCropp](https://redirect.github.com/SimonCropp) in [https://github.com/serilog/serilog/pull/1811](https://redirect.github.com/serilog/serilog/pull/1811)
- Remove redundant `GetTypeInfo()` in `LoadConfigurationAssemblies` by [@SimonCropp](https://redirect.github.com/SimonCropp) in [https://github.com/serilog/serilog/pull/1817](https://redirect.github.com/serilog/serilog/pull/1817)
- Remove `GetTypeInfo()` from `FindConfigurationMethods(()` by [@SimonCropp](https://redirect.github.com/SimonCropp) in [https://github.com/serilog/serilog/pull/1815](https://redirect.github.com/serilog/serilog/pull/1815)
- Remove redundant `GetTypeInfo()` in `EnumScalarConversionPolicy` by [@SimonCropp](https://redirect.github.com/SimonCropp) in [https://github.com/serilog/serilog/pull/1816](https://redirect.github.com/serilog/serilog/pull/1816)
- Remove obsolete `PropertyToken` constructor by [@SimonCropp](https://redirect.github.com/SimonCropp) in [https://github.com/serilog/serilog/pull/1819](https://redirect.github.com/serilog/serilog/pull/1819)
- `switch` expressions by [@SimonCropp](https://redirect.github.com/SimonCropp) in [https://github.com/serilog/serilog/pull/1818](https://redirect.github.com/serilog/serilog/pull/1818)
- Do not allocate strings for `TextWriter.Write()` by [@sungam3r](https://redirect.github.com/sungam3r) in [https://github.com/serilog/serilog/pull/1775](https://redirect.github.com/serilog/serilog/pull/1775)
- Simplify reflection in` SettingValueConversions ` by [@SimonCropp](https://redirect.github.com/SimonCropp) in [https://github.com/serilog/serilog/pull/1814](https://redirect.github.com/serilog/serilog/pull/1814)
- Improve `GetPropertiesRecursive()` performance by [@SimonCropp](https://redirect.github.com/SimonCropp) in [https://github.com/serilog/serilog/pull/1813](https://redirect.github.com/serilog/serilog/pull/1813)
- Use `Convert.ToHexString()` in `ByteArrayScalarConversionPolicy()` by [@sungam3r](https://redirect.github.com/sungam3r) in [https://github.com/serilog/serilog/pull/1776](https://redirect.github.com/serilog/serilog/pull/1776)
- Remove `FEATURE_ASYNCLOCAL` by [@SimonCropp](https://redirect.github.com/SimonCropp) in [https://github.com/serilog/serilog/pull/1822](https://redirect.github.com/serilog/serilog/pull/1822)
- Remove `FEATURE_HASHTABLE` by [@SimonCropp](https://redirect.github.com/SimonCropp) in [https://github.com/serilog/serilog/pull/1823](https://redirect.github.com/serilog/serilog/pull/1823)
- Use `IsEnum` for enum check in `EnumScalarConversionPolicy` by [@SimonCropp](https://redirect.github.com/SimonCropp) in [https://github.com/serilog/serilog/pull/1825](https://redirect.github.com/serilog/serilog/pull/1825)
- Comments on `Hashtable` use in `MessageTemplateCache` by [@SimonCropp](https://redirect.github.com/SimonCropp) in [https://github.com/serilog/serilog/pull/1828](https://redirect.github.com/serilog/serilog/pull/1828)
- Remove `GetTypeInfo()` from `PropertyValueConverter` by [@SimonCropp](https://redirect.github.com/SimonCropp) in [https://github.com/serilog/serilog/pull/1824](https://redirect.github.com/serilog/serilog/pull/1824)
- Avoid repeated `GetType()` in `PropertyValueConverter` by [@SimonCropp](https://redirect.github.com/SimonCropp) in [https://github.com/serilog/serilog/pull/1832](https://redirect.github.com/serilog/serilog/pull/1832)
- Leverage dictionary `TryAdd()` and items constructor by [@SimonCropp](https://redirect.github.com/SimonCropp) in [https://github.com/serilog/serilog/pull/1830](https://redirect.github.com/serilog/serilog/pull/1830)
- Use array instead of list when we know the size in `PropertyValueConverter` by [@SimonCropp](https://redirect.github.com/SimonCropp) in [https://github.com/serilog/serilog/pull/1831](https://redirect.github.com/serilog/serilog/pull/1831)
- Move `net46` target to `net461` by [@SimonCropp](https://redirect.github.com/SimonCropp) in [https://github.com/serilog/serilog/pull/1827](https://redirect.github.com/serilog/serilog/pull/1827)
- Clean up `JsonValueFormatter` by [@SimonCropp](https://redirect.github.com/SimonCropp) in [https://github.com/serilog/serilog/pull/1835](https://redirect.github.com/serilog/serilog/pull/1835)
- `var` in `JsonFormatter` by [@SimonCropp](https://redirect.github.com/SimonCropp) in [https://github.com/serilog/serilog/pull/1838](https://redirect.github.com/serilog/serilog/pull/1838)
- Remove obsolete `SelfLog.Out` by [@SimonCropp](https://redirect.github.com/SimonCropp) in [https://github.com/serilog/serilog/pull/1837](https://redirect.github.com/serilog/serilog/pull/1837)
- Remove obsolete `JsonFormatter` `omitEnclosingObject` overload by [@SimonCropp](https://redirect.github.com/SimonCropp) in [https://github.com/serilog/serilog/pull/1834](https://redirect.github.com/serilog/serilog/pull/1834)
- Remove obsolete `PushProperties()` by [@SimonCropp](https://redirect.github.com/SimonCropp) in [https://github.com/serilog/serilog/pull/1836](https://redirect.github.com/serilog/serilog/pull/1836)
- No point putting `_minimumLevel` and `_levelSwitch` on stack by [@SimonCropp](https://redirect.github.com/SimonCropp) in [https://github.com/serilog/serilog/pull/1840](https://redirect.github.com/serilog/serilog/pull/1840)
- Avoid casting enum to `int` where possible by [@SimonCropp](https://redirect.github.com/SimonCropp) in [https://github.com/serilog/serilog/pull/1841](https://redirect.github.com/serilog/serilog/pull/1841)
- Leverage nullable char in `JsonFormatter` by [@SimonCropp](https://redirect.github.com/SimonCropp) in [https://github.com/serilog/serilog/pull/1839](https://redirect.github.com/serilog/serilog/pull/1839)
- Use correct overload with `char` in `JsonFormatter` by [@sungam3r](https://redirect.github.com/sungam3r) in [https://github.com/serilog/serilog/pull/1842](https://redirect.github.com/serilog/serilog/pull/1842)
- Annotate Serilog for trimming by [@agocke](https://redirect.github.com/agocke) in [https://github.com/serilog/serilog/pull/1690](https://redirect.github.com/serilog/serilog/pull/1690)
- Fix `net471` `DisableImplicitFrameworkReferences` by [@SimonCropp](https://redirect.github.com/SimonCropp) in [https://github.com/serilog/serilog/pull/1846](https://redirect.github.com/serilog/serilog/pull/1846)
- Fix 461 `TargetFramework` constants in tests by [@SimonCropp](https://redirect.github.com/SimonCropp) in [https://github.com/serilog/serilog/pull/1847](https://redirect.github.com/serilog/serilog/pull/1847)
- Missing API approval by [@SimonCropp](https://redirect.github.com/SimonCropp) in [https://github.com/serilog/serilog/pull/1848](https://redirect.github.com/serilog/serilog/pull/1848)
- `net471` supports `ITuple` by [@SimonCropp](https://redirect.github.com/SimonCropp) in [https://github.com/serilog/serilog/pull/1849](https://redirect.github.com/serilog/serilog/pull/1849)
- Remove `FEATURE_GETCURRENTMETHOD` const by [@SimonCropp](https://redirect.github.com/SimonCropp) in [https://github.com/serilog/serilog/pull/1851](https://redirect.github.com/serilog/serilog/pull/1851)
- macOS CI by [@SimonCropp](https://redirect.github.com/SimonCropp) in [https://github.com/serilog/serilog/pull/1858](https://redirect.github.com/serilog/serilog/pull/1858)
- Run tests on mac by [@SimonCropp](https://redirect.github.com/SimonCropp) in [https://github.com/serilog/serilog/pull/1860](https://redirect.github.com/serilog/serilog/pull/1860)
- BenchmarkDotNet 0.13.5 by [@SimonCropp](https://redirect.github.com/SimonCropp) in [https://github.com/serilog/serilog/pull/1861](https://redirect.github.com/serilog/serilog/pull/1861)
- Cache empty text token by [@SimonCropp](https://redirect.github.com/SimonCropp) in [https://github.com/serilog/serilog/pull/1859](https://redirect.github.com/serilog/serilog/pull/1859)
- Simplify `PublicApi_Should_Not_Change_Unintentionally()` test by [@SimonCropp](https://redirect.github.com/SimonCropp) in [https://github.com/serilog/serilog/pull/1864](https://redirect.github.com/serilog/serilog/pull/1864)
- Move from `net461` to `net462` by [@SimonCropp](https://redirect.github.com/SimonCropp) in [https://github.com/serilog/serilog/pull/1863](https://redirect.github.com/serilog/serilog/pull/1863)
- Remove redundant `GetPackagingOutputs` by [@SimonCropp](https://redirect.github.com/SimonCropp) in [https://github.com/serilog/serilog/pull/1867](https://redirect.github.com/serilog/serilog/pull/1867)
- Use char delimiters by [@SimonCropp](https://redirect.github.com/SimonCropp) in [https://github.com/serilog/serilog/pull/1868](https://redirect.github.com/serilog/serilog/pull/1868)
- Remove redundant reference assemblies by [@SimonCropp](https://redirect.github.com/SimonCropp) in [https://github.com/serilog/serilog/pull/1866](https://redirect.github.com/serilog/serilog/pull/1866)
- Introduce PolySharp by [@sungam3r](https://redirect.github.com/sungam3r) in [https://github.com/serilog/serilog/pull/1845](https://redirect.github.com/serilog/serilog/pull/1845)
- Missing PolySharp changes by [@SimonCropp](https://redirect.github.com/SimonCropp) in [https://github.com/serilog/serilog/pull/1869](https://redirect.github.com/serilog/serilog/pull/1869)
- Simplify build scripts by [@SimonCropp](https://redirect.github.com/SimonCropp) in [https://github.com/serilog/serilog/pull/1865](https://redirect.github.com/serilog/serilog/pull/1865)
- Added `ReusableStringWriter` by [@igor84](https://redirect.github.com/igor84) in [https://github.com/serilog/serilog/pull/1771](https://redirect.github.com/serilog/serilog/pull/1771)
- PublicApiGenerator v11 by [@SimonCropp](https://redirect.github.com/SimonCropp) in [https://github.com/serilog/serilog/pull/1877](https://redirect.github.com/serilog/serilog/pull/1877)
- Use `langword` in XML comments by [@sungam3r](https://redirect.github.com/sungam3r) in [https://github.com/serilog/serilog/pull/1871](https://redirect.github.com/serilog/serilog/pull/1871)
- Avoid creating `SafeAggregateSink` wrapper around empty list by [@sungam3r](https://redirect.github.com/sungam3r) in [https://github.com/serilog/serilog/pull/1878](https://redirect.github.com/serilog/serilog/pull/1878)
- Remove obsolete classes by [@sungam3r](https://redirect.github.com/sungam3r) in [https://github.com/serilog/serilog/pull/1874](https://redirect.github.com/serilog/serilog/pull/1874)
- Add space settings by [@sungam3r](https://redirect.github.com/sungam3r) in [https://github.com/serilog/serilog/pull/1885](https://redirect.github.com/serilog/serilog/pull/1885)
- Make `Alignment` and `LevelOverrides` readonly by [@sungam3r](https://redirect.github.com/sungam3r) in [https://github.com/serilog/serilog/pull/1884](https://redirect.github.com/serilog/serilog/pull/1884)
- Remove redundant `CallerArgumentExpressionAttribute` by [@SimonCropp](https://redirect.github.com/SimonCropp) in [https://github.com/serilog/serilog/pull/1886](https://redirect.github.com/serilog/serilog/pull/1886)
- Remove `MessageTemplateToken.StartIndex` by [@SimonCropp](https://redirect.github.com/SimonCropp) in [https://github.com/serilog/serilog/pull/1882](https://redirect.github.com/serilog/serilog/pull/1882)
- Microsoft.NET.Test.Sdk 17.5.0 by [@SimonCropp](https://redirect.github.com/SimonCropp) in [https://github.com/serilog/serilog/pull/1862](https://redirect.github.com/serilog/serilog/pull/1862)
- Throw, rather than exit, when any command in the build script fails by [@nblumhardt](https://redirect.github.com/nblumhardt) in [https://github.com/serilog/serilog/pull/1887](https://redirect.github.com/serilog/serilog/pull/1887)
- Suppress some warnings, tidy up some namespacing by [@nblumhardt](https://redirect.github.com/nblumhardt) in [https://github.com/serilog/serilog/pull/1888](https://redirect.github.com/serilog/serilog/pull/1888)
- Reinstate `LoggerSinkConfiguration.Sink(ILogEventSink, LogEventLevel)` by [@nblumhardt](https://redirect.github.com/nblumhardt) in [https://github.com/serilog/serilog/pull/1889](https://redirect.github.com/serilog/serilog/pull/1889)
- Avoid some alloc with `Array.Empty` by [@SimonCropp](https://redirect.github.com/SimonCropp) in [https://github.com/serilog/serilog/pull/1898](https://redirect.github.com/serilog/serilog/pull/1898)
- Destructure `ReadOnlyDictionary` as `Dictionary` by [@sungam3r](https://redirect.github.com/sungam3r) in [https://github.com/serilog/serilog/pull/1897](https://redirect.github.com/serilog/serilog/pull/1897)
- Remove redundant `IDictionary` cast by [@SimonCropp](https://redirect.github.com/SimonCropp) in [https://github.com/serilog/serilog/pull/1900](https://redirect.github.com/serilog/serilog/pull/1900)
- Adding ability to dispose nested loggers in `WriteTo.Logger()` by [@srogovtsev](https://redirect.github.com/srogovtsev) in [https://github.com/serilog/serilog/pull/1890](https://redirect.github.com/serilog/serilog/pull/1890)
- Optimize `AddPropertyIfAbsent` by [@sungam3r](https://redirect.github.com/sungam3r) in [https://github.com/serilog/serilog/pull/1872](https://redirect.github.com/serilog/serilog/pull/1872)
- Accept/pass through the standard `levelSwitch` option in `WriteTo.Logger()` by [@nblumhardt](https://redirect.github.com/nblumhardt) in [https://github.com/serilog/serilog/pull/1902](https://redirect.github.com/serilog/serilog/pull/1902)
- Add `net47` target by [@SimonCropp](https://redirect.github.com/SimonCropp) in [https://github.com/serilog/serilog/pull/1905](https://redirect.github.com/serilog/serilog/pull/1905)
- Annotate `WithProperty()` by [@sungam3r](https://redirect.github.com/sungam3r) in [https://github.com/serilog/serilog/pull/1907](https://redirect.github.com/serilog/serilog/pull/1907)
- Add `LoggingLevelSwitch.MinimumLevelChanged` by [@sungam3r](https://redirect.github.com/sungam3r) in [https://github.com/serilog/serilog/pull/1908](https://redirect.github.com/serilog/serilog/pull/1908)
- Fix [#1464](https://redirect.github.com/serilog/serilog/issues/1464), don't log parameter count mismatch message incorrectly by [@nblumhardt](https://redirect.github.com/nblumhardt) in [https://github.com/serilog/serilog/pull/1903](https://redirect.github.com/serilog/serilog/pull/1903)
- Add `Destructure.AsDictionary()` by [@sungam3r](https://redirect.github.com/sungam3r) in [https://github.com/serilog/serilog/pull/1906](https://redirect.github.com/serilog/serilog/pull/1906)
- Add `LevelAlias.Off`; fixes [#1684](https://redirect.github.com/serilog/serilog/issues/1684) by [@nblumhardt](https://redirect.github.com/nblumhardt) in [https://github.com/serilog/serilog/pull/1910](https://redirect.github.com/serilog/serilog/pull/1910)
- Use `JsonValueFormatter` to implement classic `JsonFormatter` by [@nblumhardt](https://redirect.github.com/nblumhardt) in [https://github.com/serilog/serilog/pull/1911](https://redirect.github.com/serilog/serilog/pull/1911)
- Include `README.md` in the NuGet package for display on nuget.org by [@nblumhardt](https://redirect.github.com/nblumhardt) in [https://github.com/serilog/serilog/pull/1916](https://redirect.github.com/serilog/serilog/pull/1916)
### [`v2.12.0`](https://redirect.github.com/serilog/serilog/releases/tag/v2.12.0)
#### Highlights of 2.12.0
##### Improved and expanded `enable` support
A huge number of commits have gone into completing and refining non-null reference type annotations, which now cover the entire public Serilog API. The Serilog project itself now builds with non-null reference type checking globally enabled :tada:
##### `IAsyncDisposable` support
Sinks that need to flush changes using asynchronous APIs can now implement `IAsyncDisposable` and prevent the possibility of deadlocking while waiting for tasks to complete.
To drive this, `Logger` can now be disposed via `using async`:
```csharp
await using var log = new LoggerConfiguration().CreateLogger();
```
and the `Log` class provides `Log.CloseAndFlushAsync()`:
```csharp
await Log.CloseAndFlushAsync();
```
##### `DateOnly` and `TimeOnly` support
The `DateOnly` and `TimeOnly` types introduced in .NET 6 are now correctly handled as scalar values when capturing.
#### Merged PRs
- [#1713](https://redirect.github.com/serilog/serilog/issues/1713), [#1716](https://redirect.github.com/serilog/serilog/issues/1716), [#1715](https://redirect.github.com/serilog/serilog/issues/1715), [#1722](https://redirect.github.com/serilog/serilog/issues/1722), [#1721](https://redirect.github.com/serilog/serilog/issues/1721), [#1720](https://redirect.github.com/serilog/serilog/issues/1720), [#1729](https://redirect.github.com/serilog/serilog/issues/1729) - improved non-null reference type annotations ([@SimonCropp](https://redirect.github.com/SimonCropp))
- [#1702](https://redirect.github.com/serilog/serilog/issues/1702) - `DateOnly` and `TimeOnly` support ([@SimonCropp](https://redirect.github.com/SimonCropp))
- [#1764](https://redirect.github.com/serilog/serilog/issues/1764), [#1703](https://redirect.github.com/serilog/serilog/issues/1703), [#1708](https://redirect.github.com/serilog/serilog/issues/1708), [#1709](https://redirect.github.com/serilog/serilog/issues/1709), [#1712](https://redirect.github.com/serilog/serilog/issues/1712), [#1724](https://redirect.github.com/serilog/serilog/issues/1724), [#1730](https://redirect.github.com/serilog/serilog/issues/1730), [#1747](https://redirect.github.com/serilog/serilog/issues/1747) - build and dependency updates ([@SimonCropp](https://redirect.github.com/SimonCropp))
- [#1723](https://redirect.github.com/serilog/serilog/issues/1723), [#1728](https://redirect.github.com/serilog/serilog/issues/1728), [#1731](https://redirect.github.com/serilog/serilog/issues/1731), [#1732](https://redirect.github.com/serilog/serilog/issues/1732), [#1734](https://redirect.github.com/serilog/serilog/issues/1734), [#1735](https://redirect.github.com/serilog/serilog/issues/1735), [#1733](https://redirect.github.com/serilog/serilog/issues/1733), [#1736](https://redirect.github.com/serilog/serilog/issues/1736), [#1739](https://redirect.github.com/serilog/serilog/issues/1739), [#1746](https://redirect.github.com/serilog/serilog/issues/1746), [#1745](https://redirect.github.com/serilog/serilog/issues/1745), [#1741](https://redirect.github.com/serilog/serilog/issues/1741), [#1742](https://redirect.github.com/serilog/serilog/issues/1742) - code clean-up and modernization ([@SimonCropp](https://redirect.github.com/SimonCropp))
- [#1750](https://redirect.github.com/serilog/serilog/issues/1750) - `IAsyncDisposable` support for `Logger` and sinks ([@nblumhardt](https://redirect.github.com/nblumhardt))
- [#1699](https://redirect.github.com/serilog/serilog/issues/1699) - fix some XDOC documentation ([@sungam3r](https://redirect.github.com/sungam3r))
- [#1719](https://redirect.github.com/serilog/serilog/issues/1719) - remove redundant `!` operator from `null` in conditions ([@sungam3r](https://redirect.github.com/sungam3r))
- [#1725](https://redirect.github.com/serilog/serilog/issues/1725) - introduce file-scoped namespaces ([@sungam3r](https://redirect.github.com/sungam3r))
- [#1700](https://redirect.github.com/serilog/serilog/issues/1700), [#1704](https://redirect.github.com/serilog/serilog/issues/1704), [#1707](https://redirect.github.com/serilog/serilog/issues/1707) - more nulllable annotation updates ([@nblumhardt](https://redirect.github.com/nblumhardt))
- [#1711](https://redirect.github.com/serilog/serilog/issues/1711) - fix support for `ValueTuple` ([@SimonCropp](https://redirect.github.com/SimonCropp))
### [`v2.11.0`](https://redirect.github.com/serilog/serilog/releases/tag/v2.11.0)
- [#1503](https://redirect.github.com/serilog/serilog/issues/1503) - make some local functions `static` to avoid scope capture ([@SimonCropp](https://redirect.github.com/SimonCropp))
- [#1561](https://redirect.github.com/serilog/serilog/issues/1561) - add support for collections/`string[]` to key-value settings ([@stochmal](https://redirect.github.com/stochmal))
- [#1588](https://redirect.github.com/serilog/serilog/issues/1588), [#1591](https://redirect.github.com/serilog/serilog/issues/1591), [#1593](https://redirect.github.com/serilog/serilog/issues/1593), [#1594](https://redirect.github.com/serilog/serilog/issues/1594), [#1597](https://redirect.github.com/serilog/serilog/issues/1597) - nullable reference type annotations and language version updates ([@SimonCropp](https://redirect.github.com/SimonCropp))
- [#1595](https://redirect.github.com/serilog/serilog/issues/1595) - `net5.0` target ([@nblumhardt](https://redirect.github.com/nblumhardt))
- [#1652](https://redirect.github.com/serilog/serilog/issues/1652) - fix capturing of anonymous types in .NET interactive ([@KZedan](https://redirect.github.com/KZedan))
- [#1641](https://redirect.github.com/serilog/serilog/issues/1641) - corrected documentation comments for `MessageTemplateFormatMethod` ([@JinsPeter](https://redirect.github.com/JinsPeter))
- [#1635](https://redirect.github.com/serilog/serilog/issues/1635) - fix destructuring of `Memory`/`ReadOnlyMemory` and non-reflection-compatible properties e.g. of type `Span` ([@skomis-mm](https://redirect.github.com/skomis-mm))
- [#1625](https://redirect.github.com/serilog/serilog/issues/1625) - update issue template ([@augustoproiete](https://redirect.github.com/augustoproiete))
- [#1664](https://redirect.github.com/serilog/serilog/issues/1664) - update `ILogger` documentation ([@erichiller](https://redirect.github.com/erichiller))
### [`v2.10.0`](https://redirect.github.com/serilog/serilog/releases/tag/v2.10.0)
- [#1370](https://redirect.github.com/serilog/serilog/issues/1370), [#1374](https://redirect.github.com/serilog/serilog/issues/1374) - improve test coverage ([@rafaelsc](https://redirect.github.com/rafaelsc))
- [#1371](https://redirect.github.com/serilog/serilog/issues/1371), [#1377](https://redirect.github.com/serilog/serilog/issues/1377), [#1429](https://redirect.github.com/serilog/serilog/issues/1429), [#1445](https://redirect.github.com/serilog/serilog/issues/1445) - documentation updates ([@perjahn](https://redirect.github.com/perjahn), [@morgankenyon](https://redirect.github.com/morgankenyon), [@rafaelsc](https://redirect.github.com/rafaelsc), [@JakenVeina](https://redirect.github.com/JakenVeina))
- [#1378](https://redirect.github.com/serilog/serilog/issues/1378), [#1392](https://redirect.github.com/serilog/serilog/issues/1392) - build fixes ([@nblumhardt](https://redirect.github.com/nblumhardt))
- [#1477](https://redirect.github.com/serilog/serilog/issues/1477) - don't fail to log when `ToString()` throws an exception ([@rafaelsc](https://redirect.github.com/rafaelsc))
- [#1435](https://redirect.github.com/serilog/serilog/issues/1435) - `netstandard2.1` support and default implementations for `ILogger` methods ([@skomis-mm](https://redirect.github.com/skomis-mm))
- [#1442](https://redirect.github.com/serilog/serilog/issues/1442) - `MinimumLevel.Override()` runtime optimizations ([@skomis-mm](https://redirect.github.com/skomis-mm))
- [#1463](https://redirect.github.com/serilog/serilog/issues/1463) - fix disposal of wrapped sinks through `LoggerSinkConfiguration.Wrap()`
- [#1449](https://redirect.github.com/serilog/serilog/issues/1449) - allow exceptions to bubble up through wrapped aggregate sinks ([@augustoproiete](https://redirect.github.com/augustoproiete))
- [#1466](https://redirect.github.com/serilog/serilog/issues/1466) - internal wrapper sink refactoring ([@nblumhardt](https://redirect.github.com/nblumhardt))
- [#1427](https://redirect.github.com/serilog/serilog/issues/1427), [#1452](https://redirect.github.com/serilog/serilog/issues/1452), [#1467](https://redirect.github.com/serilog/serilog/issues/1467) - when `ToString()` on a logged object returns `null`, serialize as `""` ([@rafaelsc](https://redirect.github.com/rafaelsc), [@nblumhardt](https://redirect.github.com/nblumhardt))
- [#1472](https://redirect.github.com/serilog/serilog/issues/1472) - improve handling of minimum level overrides in sub-loggers ([@skomis-mm](https://redirect.github.com/skomis-mm))
Configuration
📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
[ ] If you want to rebase/retry this PR, check this box
This PR contains the following updates:
2.9.0
->4.1.0
Release Notes
serilog/serilog (Serilog)
### [`v4.1.0`](https://redirect.github.com/serilog/serilog/releases/tag/v4.1.0) - [#2108](https://redirect.github.com/serilog/serilog/issues/2108) - failure listeners and fallback sinks ([@nblumhardt](https://redirect.github.com/nblumhardt)) - [#2120](https://redirect.github.com/serilog/serilog/issues/2120) - add `BatchingOptions.RetryTimeLimit` and [update retry scheduling algorithm](https://nblumhardt.com/2024/10/retry-time-limit/) ([@nblumhardt](https://redirect.github.com/nblumhardt)) #### Important note `IBatchedLogEventSink` batch retry scheduling has changed in this version. The default configuration still tries failed batches for approximately ten minutes, but the `BufferingTimeLimit` no longer implicitly causes the retry time to be extended or reduced. If you need a specific retry time, set `BatchingOptions.RetryTimeLimit`, which reliably controls retry time. ### [`v4.0.2`](https://redirect.github.com/serilog/serilog/releases/tag/v4.0.2) - [#2094](https://redirect.github.com/serilog/serilog/issues/2094) - remove boxing and string allocations in output template formatting ([@epeshk](https://redirect.github.com/epeshk)) - [#2103](https://redirect.github.com/serilog/serilog/issues/2103) - don't capture properties with private `get` accessors ([@nblumhardt](https://redirect.github.com/nblumhardt)) - [#2095](https://redirect.github.com/serilog/serilog/issues/2095) - remove junk file ([@Numpsy](https://redirect.github.com/Numpsy)) - [#2116](https://redirect.github.com/serilog/serilog/issues/2116) - fall back to `IDisposable` in `Log.CloseAndFlushAsync()` when the target logger is not `IAsyncDisposable` ([@nblumhardt](https://redirect.github.com/nblumhardt)) ### [`v4.0.1`](https://redirect.github.com/serilog/serilog/releases/tag/v4.0.1) - [#2090](https://redirect.github.com/serilog/serilog/issues/2090) — when capturing structured values, reuse `HashSet` instances, reduce LINQ usage, avoid reallocating `string[]` to improve performance and cut GC pressure ([@nblumhardt](https://redirect.github.com/nblumhardt)) - [#2089](https://redirect.github.com/serilog/serilog/issues/2089) - allow capturing of non-anonymous structured values when trimming ([@nblumhardt](https://redirect.github.com/nblumhardt)) - [#2083](https://redirect.github.com/serilog/serilog/issues/2083) - use `Major.Minor.0.0` assembly versioning ([@nblumhardt](https://redirect.github.com/nblumhardt)) ### [`v4.0.0`](https://redirect.github.com/serilog/serilog/releases/tag/v4.0.0) #### What's new in Serilog 4.0.0? > If you're deploying to .NET Framework, note that Serilog's **assembly version** number has [been unpinned](https://redirect.github.com/serilog/serilog/issues/2015) from the long-running historical `2.0.0` default, and now matches the package version precisely. If you encounter issues, ensure your build is generating valid assembly binding redirects. ##### Simple, robust, built-in batching support Sinks that need batching functionality [can now be easily written](https://redirect.github.com/serilog/serilog/issues/2055), without any additional package dependencies, by implementing `IBatchedLogEventSink`: ```csharp class MyBatchedSink: IBatchedLogEventSink { public Task EmitBatchAsync(IReadOnlyCollectionConfiguration
📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.