-
Notifications
You must be signed in to change notification settings - Fork 645
/
Copy pathDiagnosticsService.cs
33 lines (28 loc) · 1.05 KB
/
DiagnosticsService.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
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.Globalization;
namespace NuGetGallery.Diagnostics
{
public class DiagnosticsService : IDiagnosticsService
{
private readonly ITelemetryClient _telemetryClient;
public DiagnosticsService(ITelemetryClient telemetryClient)
{
_telemetryClient = telemetryClient ?? throw new ArgumentNullException(nameof(telemetryClient));
}
public IDiagnosticsSource GetSource(string name)
{
if (string.IsNullOrEmpty(name))
{
throw new ArgumentException(
string.Format(
CultureInfo.CurrentCulture,
ServicesStrings.ParameterCannotBeNullOrEmpty,
"name"),
nameof(name));
}
return new TraceDiagnosticsSource(name, _telemetryClient);
}
}
}