Adds a DebugChannel for TelemetryClient
This commit is contained in:
parent
cdd645bb3b
commit
b2c0919a8c
8 changed files with 203 additions and 47 deletions
|
|
@ -6,6 +6,8 @@ using Core.ModuleRegistry;
|
|||
using Microsoft.ApplicationInsights;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Core.Configurations.JsonConfigProvider;
|
||||
using Serilog;
|
||||
using Serilog.Extensions.Logging;
|
||||
namespace Tests
|
||||
{
|
||||
/// <summary>
|
||||
|
|
@ -43,13 +45,31 @@ namespace Tests
|
|||
{
|
||||
IConfigurationRoot configuration = Configuration();
|
||||
|
||||
//var logger = new LoggerConfiguration()
|
||||
// .MinimumLevel.Verbose()
|
||||
// .MinimumLevel.Override("Microsoft", Serilog.Events.LogEventLevel.Warning)
|
||||
// .MinimumLevel.Override("System", Serilog.Events.LogEventLevel.Error)
|
||||
// .WriteTo.Seq("http://localhost:5341", apiKey: "Gt8hS9ClGNfOCAdswDlW")
|
||||
// .WriteTo.ApplicationInsights(configuration.Get<string>("ApplicationInsights:ConnectionString"),
|
||||
// TelemetryConverter.Traces)
|
||||
// .Enrich.FromLogContext()
|
||||
// .Enrich.WithMachineName()
|
||||
// .CreateLogger();
|
||||
|
||||
//Log.Logger = logger;
|
||||
|
||||
//Log.Logger.Verbose("Is thos work");
|
||||
var builder = new ContainerBuilder();
|
||||
builder.RegisterInstance(new LoggerFactory())
|
||||
.As<ILoggerFactory>();
|
||||
|
||||
|
||||
//builder.Register(c => new SerilogLoggerFactory(logger))
|
||||
// .As<ILoggerFactory>()
|
||||
// .SingleInstance();
|
||||
|
||||
builder.RegisterGeneric(typeof(Logger<>))
|
||||
.As(typeof(ILogger<>))
|
||||
.SingleInstance();
|
||||
.As(typeof(ILogger<>))
|
||||
.SingleInstance();
|
||||
|
||||
|
||||
builder.RegisterModule(new Core.ModuleRegistry.DbPostgreSqlModule
|
||||
{
|
||||
|
|
@ -62,13 +82,14 @@ namespace Tests
|
|||
});
|
||||
|
||||
|
||||
|
||||
ContainerBuilder = builder;
|
||||
}
|
||||
|
||||
[TestCleanup]
|
||||
public void CleanUp()
|
||||
{
|
||||
//Serilog.Log.CloseAndFlush();
|
||||
|
||||
Trace.Flush();
|
||||
var telemetryClient = Container.Resolve<TelemetryClient>();
|
||||
telemetryClient.Flush();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue