public void WeaveMyApplication() { TraceLoggingConfiguration.TraceLoggingConfigurationBuilder config = TraceLoggingConfiguration.New .WithFilter(new PublicMethodsFilter()) .WithAdapterAssembly(typeof(Serilog.Log).Assembly.GetName().FullName) .WithLogManager(typeof(Serilog.Adapters.LogManagerAdapter).FullName) .WithLogger(typeof(Serilog.Adapters.LoggerAdapter).FullName) .WithStaticLogger(typeof(Serilog.Log).FullName); AssemblyWeaver.Execute("..\\..\\..\\TestApplication.Serilog\\bin\\debug\\TestApplication.Serilog.exe", config); }
protected void Rewrite(string assemblyPath, ITraceLoggingFilter filter, bool traceConstructors = false) { //Set-up log adapter to our mock Assembly assembly = Assembly.GetExecutingAssembly(); TraceLoggingConfiguration.TraceLoggingConfigurationBuilder config = TraceLoggingConfiguration.New .WithFilter(filter) .WithAdapterAssembly(assembly.GetName().FullName) .WithLogManager(typeof(MockLogManagerAdapter).FullName) .WithLogger(typeof(MockLogAdapter).FullName) .WithStaticLogger(typeof(MockLog).FullName); if (traceConstructors) { config.WithConstructorTraceOn(); } AssemblyWeaver.Execute(assemblyPath, config); }