This repository has been archived on 2026-06-12. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
Xorog.Logger/LoggerProvider.cs

20 lines
559 B
C#

using Microsoft.Extensions.Logging;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Xorog.Logger;
public class LoggerProvider : ILoggerProvider
{
private readonly ConcurrentDictionary<string, Logger> _loggers = new(StringComparer.OrdinalIgnoreCase);
public ILogger CreateLogger(string categoryName)
{
return _loggers.GetOrAdd(categoryName, name => new Logger());
}
public void Dispose() => _loggers.Clear();
}