forked from salween/Four2n.MiniProfiler
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathContainerModule.cs
More file actions
54 lines (45 loc) · 1.93 KB
/
ContainerModule.cs
File metadata and controls
54 lines (45 loc) · 1.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="ContainerModule.cs" company="Daniel Dabrowski - rod.42n.pl">
// Copyright (c) 2008 Daniel Dabrowski - 42n. All rights reserved.
// </copyright>
// <summary>
// Defines the ContainerModule type.
// </summary>
// --------------------------------------------------------------------------------------------------------------------
namespace Four2n.Orchard.MiniProfiler
{
using System;
using Autofac;
using Four2n.Orchard.MiniProfiler.Formatters;
using global::Orchard.Environment;
using StackExchange.Profiling;
using StackExchange.Profiling.Storage;
using Module = Autofac.Module;
public class ContainerModule : Module
{
private readonly IOrchardHost orchardHost;
public ContainerModule(IOrchardHost orchardHost)
{
this.orchardHost = orchardHost;
}
protected override void Load(ContainerBuilder moduleBuilder)
{
InitProfilerSettings();
var currentLogger = ((DefaultOrchardHost)this.orchardHost).Logger;
if (currentLogger is OrchardHostProxyLogger)
{
return;
}
((DefaultOrchardHost)this.orchardHost).Logger = new OrchardHostProxyLogger(currentLogger);
}
private static void InitProfilerSettings()
{
MiniProfiler.Settings.SqlFormatter = new PoorMansTSqlFormatter();
MiniProfiler.Settings.Storage = new HttpRuntimeCacheStorage(TimeSpan.FromHours(1));
MiniProfiler.Settings.StackMaxLength = 500;
MiniProfiler.Settings.ExcludeAssembly("MiniProfiler");
MiniProfiler.Settings.ExcludeAssembly("NHibernate");
WebRequestProfilerProvider.Settings.UserProvider = new IpAddressIdentity();
}
}
}