| | | 1 | | using Elsa.Diagnostics.StructuredLogs.Contracts; |
| | | 2 | | using Elsa.Diagnostics.StructuredLogs.Options; |
| | | 3 | | using Microsoft.Extensions.Logging; |
| | | 4 | | using Microsoft.Extensions.Options; |
| | | 5 | | |
| | | 6 | | namespace Elsa.Diagnostics.StructuredLogs.Logging; |
| | | 7 | | |
| | | 8 | | [ProviderAlias("ElsaStructuredLogs")] |
| | 5 | 9 | | public class StructuredLogLoggerProvider( |
| | 5 | 10 | | IStructuredLogProvider logProvider, |
| | 5 | 11 | | IStructuredLogRedactor redactor, |
| | 5 | 12 | | IStructuredLogSourceRegistry sourceRegistry, |
| | 5 | 13 | | IOptions<StructuredLogsOptions> options) : ILoggerProvider, ISupportExternalScope |
| | | 14 | | { |
| | 5 | 15 | | private IExternalScopeProvider _scopeProvider = new LoggerExternalScopeProvider(); |
| | | 16 | | |
| | | 17 | | public ILogger CreateLogger(string categoryName) |
| | | 18 | | { |
| | 11 | 19 | | return new StructuredLogLogger(categoryName, logProvider, redactor, sourceRegistry, options.Value, () => _scopeP |
| | | 20 | | } |
| | | 21 | | |
| | | 22 | | public void SetScopeProvider(IExternalScopeProvider scopeProvider) |
| | | 23 | | { |
| | 0 | 24 | | _scopeProvider = scopeProvider; |
| | 0 | 25 | | } |
| | | 26 | | |
| | | 27 | | public void Dispose() |
| | | 28 | | { |
| | 0 | 29 | | } |
| | | 30 | | } |