Files
ClubPenguinClient/MareSynchronos/Interop/DalamudLoggingProvider.cs
rootdarkarchon 14575a4a6b Mare 0.9 (#65)
* add jwt expiry

* start of 0.9 api impl

* some stuff idk

* some more impl

* some cleanup

* remove grouppair, add configuration, rework some pair drawing stuff

* do some stuff

* rework some ui

* I don't even know anymore

* add cancellationtoken

* token bla

* ui fixes etc

* probably individual adding/removing now working fully as expected

* add working report popup

* I guess it's more syncshell shit or so

* popup shit idk

* work out most of the syncshell bullshit I guess

* delete some old crap

* are we actually getting closer to the end

* update pair info stuff

* more fixes/adjustments, idk

* refactor some things

* some rework

* some more cleanup

* cleanup

* make menu buttons w i d e

* better icon text buttons

* add all syncshell folder and ordering fixes

---------

Co-authored-by: rootdarkarchon <root.darkarchon@outlook.com>
2023-10-17 21:36:44 +02:00

44 lines
1.3 KiB
C#

using Dalamud.Plugin.Services;
using MareSynchronos.MareConfiguration;
using Microsoft.Extensions.Logging;
using System.Collections.Concurrent;
namespace MareSynchronos.Interop;
[ProviderAlias("Dalamud")]
public sealed class DalamudLoggingProvider : ILoggerProvider
{
private readonly ConcurrentDictionary<string, DalamudLogger> _loggers =
new(StringComparer.OrdinalIgnoreCase);
private readonly MareConfigService _mareConfigService;
private readonly IPluginLog _pluginLog;
public DalamudLoggingProvider(MareConfigService mareConfigService, IPluginLog pluginLog)
{
_mareConfigService = mareConfigService;
_pluginLog = pluginLog;
}
public ILogger CreateLogger(string categoryName)
{
string catName = categoryName.Split(".", StringSplitOptions.RemoveEmptyEntries).Last();
if (catName.Length > 15)
{
catName = string.Join("", catName.Take(6)) + "..." + string.Join("", catName.TakeLast(6));
}
else
{
catName = string.Join("", Enumerable.Range(0, 15 - catName.Length).Select(_ => " ")) + catName;
}
return _loggers.GetOrAdd(catName, name => new DalamudLogger(name, _mareConfigService, _pluginLog));
}
public void Dispose()
{
_loggers.Clear();
GC.SuppressFinalize(this);
}
}