/
githubmirror
/
roslyn
Обзор
Документация
Войти
/
githubmirror
/
roslyn
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
src/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/Logging/ServerLoggerFactory.cs
46 строк
1 KB
Cyrus Najmabadi
Make sealed
26 мар 2025, 22:21
26 мар 2025, 22:21
d99b771
Код
Авторство
О чём код?
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using System.Composition; using Microsoft.CodeAnalysis.Host.Mef; using Microsoft.Extensions.Logging; namespace Microsoft.CodeAnalysis.LanguageServer.Logging; [Export(typeof(ILoggerFactory))] [Export(typeof(ServerLoggerFactory))] [Shared] internal sealed class ServerLoggerFactory : ILoggerFactory { private ILoggerFactory? _loggerFactory; [ImportingConstructor] [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] public ServerLoggerFactory() { } public void SetFactory(ILoggerFactory loggerFactory) { Contract.ThrowIfTrue(_loggerFactory is not null); _loggerFactory = loggerFactory; } void ILoggerFactory.AddProvider(ILoggerProvider provider) { Contract.ThrowIfNull(_loggerFactory); _loggerFactory.AddProvider(provider); } ILogger ILoggerFactory.CreateLogger(string categoryName) { Contract.ThrowIfNull(_loggerFactory); return _loggerFactory.CreateLogger(categoryName); } void IDisposable.Dispose() { _loggerFactory?.Dispose(); } }