mirror of
https://github.com/AlexMacocian/WpfExtended.git
synced 2026-07-21 01:19:29 +00:00
77a47b5d69
Implement default logger providers that would use CV ILogsWriter for quick implementation of logs sink Co-authored-by: Alexandru Macocian <almacoci@microsoft.com>
54 lines
1.4 KiB
C#
54 lines
1.4 KiB
C#
using Microsoft.Extensions.Logging;
|
|
using Slim;
|
|
using System;
|
|
using System.Extensions;
|
|
using System.Net.Http;
|
|
using System.Windows.Extensions;
|
|
using System.Windows.Extensions.Http;
|
|
using WpfExtended.Test;
|
|
using WpfExtended.Tests.Http;
|
|
|
|
namespace WpfExtended.Tests
|
|
{
|
|
public class Launcher : ExtendedApplication<MainWindow>
|
|
{
|
|
private static Launcher Instance { get; } = new Launcher();
|
|
|
|
[STAThread]
|
|
public static int Main()
|
|
{
|
|
return Instance.Run();
|
|
}
|
|
|
|
protected override void SetupServiceManager(IServiceManager serviceManager)
|
|
{
|
|
serviceManager.RegisterDebugLoggerFactory();
|
|
serviceManager.RegisterResolver(
|
|
new HttpClientResolver()
|
|
.WithHttpMessageHandlerFactory((sp, category) =>
|
|
{
|
|
var loggerType = typeof(ILogger<>).MakeGenericType(category);
|
|
var logger = sp.GetService(loggerType).As<ILogger>();
|
|
return new HttpMessageLogger(logger, new HttpClientHandler());
|
|
}));
|
|
}
|
|
|
|
protected override void ApplicationClosing()
|
|
{
|
|
}
|
|
|
|
protected override void ApplicationStarting()
|
|
{
|
|
}
|
|
|
|
protected override bool HandleException(Exception e)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
protected override void RegisterServices(IServiceProducer serviceProducer)
|
|
{
|
|
}
|
|
}
|
|
}
|