-
Notifications
You must be signed in to change notification settings - Fork 1
/
RaygunConfigurator.cs
58 lines (49 loc) · 1.71 KB
/
RaygunConfigurator.cs
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
55
56
57
58
using Telerik.Microsoft.Practices.EnterpriseLibrary.Common.Configuration;
using Telerik.Sitefinity.Abstractions;
using Telerik.Sitefinity.Logging;
namespace ExternalLogging
{
/// <summary>
/// An <see cref="ISitefinityLogCategoryConfigurator"/>
/// implementation for configuring Raygun logging.
/// </summary>
public class RaygunConfigurator : ISitefinityLogCategoryConfigurator
{
#region Constructors
/// <summary>
/// Initializes a new instance of the <see cref="RaygunConfigurator"/> class.
/// </summary>
/// <param name="next">
/// The default configurator to be used.
/// If the current configurator cannot handle the call it will forward it to the next one.
/// </param>
/// <param name="policy">The configuration policy for which the trace listener will be called.</param>
public RaygunConfigurator(ISitefinityLogCategoryConfigurator next, ConfigurationPolicy policy)
{
this.next = next;
this.policy = policy;
}
#endregion
#region Public methods
/// <inheritdoc />
public void Configure(SitefinityLogCategory category)
{
if (category.Name == this.policy.ToString())
{
category.Configuration
.WithOptions
.SendTo
.Custom<RaygunTraceListener>("Custom");
}
else
{
this.next.Configure(category);
}
}
#endregion
#region Private members
private ISitefinityLogCategoryConfigurator next;
private ConfigurationPolicy policy;
#endregion
}
}