 14575a4a6b
			
		
	
	14575a4a6b
	
	
	
		
			
			* 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>
		
			
				
	
	
		
			47 lines
		
	
	
		
			1.5 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
			
		
		
	
	
			47 lines
		
	
	
		
			1.5 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
| using Dalamud.Plugin.Services;
 | |
| using MareSynchronos.MareConfiguration;
 | |
| using Microsoft.Extensions.Logging;
 | |
| using System.Text;
 | |
| 
 | |
| namespace MareSynchronos.Interop;
 | |
| 
 | |
| internal sealed class DalamudLogger : ILogger
 | |
| {
 | |
|     private readonly MareConfigService _mareConfigService;
 | |
|     private readonly string _name;
 | |
|     private readonly IPluginLog _pluginLog;
 | |
| 
 | |
|     public DalamudLogger(string name, MareConfigService mareConfigService, IPluginLog pluginLog)
 | |
|     {
 | |
|         _name = name;
 | |
|         _mareConfigService = mareConfigService;
 | |
|         _pluginLog = pluginLog;
 | |
|     }
 | |
| 
 | |
|     public IDisposable BeginScope<TState>(TState state) => default!;
 | |
| 
 | |
|     public bool IsEnabled(LogLevel logLevel)
 | |
|     {
 | |
|         return (int)_mareConfigService.Current.LogLevel <= (int)logLevel;
 | |
|     }
 | |
| 
 | |
|     public void Log<TState>(LogLevel logLevel, EventId eventId, TState state, Exception? exception, Func<TState, Exception?, string> formatter)
 | |
|     {
 | |
|         if (!IsEnabled(logLevel)) return;
 | |
| 
 | |
|         if ((int)logLevel <= (int)LogLevel.Information)
 | |
|             _pluginLog.Information($"[{_name}]{{{(int)logLevel}}} {state}");
 | |
|         else
 | |
|         {
 | |
|             StringBuilder sb = new();
 | |
|             sb.AppendLine($"[{_name}]{{{(int)logLevel}}} {state}: {exception?.Message}");
 | |
|             sb.AppendLine(exception?.StackTrace);
 | |
|             if (logLevel == LogLevel.Warning)
 | |
|                 _pluginLog.Warning(sb.ToString());
 | |
|             else if (logLevel == LogLevel.Error)
 | |
|                 _pluginLog.Error(sb.ToString());
 | |
|             else
 | |
|                 _pluginLog.Fatal(sb.ToString());
 | |
|         }
 | |
|     }
 | |
| } |