Skip to content

Commit 2d46bd8

Browse files
remove logging methods from client (inherited by internals)
1 parent 978ce68 commit 2d46bd8

File tree

1 file changed

+0
-78
lines changed

1 file changed

+0
-78
lines changed
Lines changed: 0 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
using System;
2-
using System.Diagnostics;
3-
using System.Linq;
42
using Microsoft.Extensions.Logging;
53

64
namespace OmniSharp.Extensions.LanguageServer.Client.Logging
@@ -37,81 +35,5 @@ public static void LogError(this ILogger logger, Exception exception, string mes
3735

3836
logger.LogError(GenericErrorEventId, exception, message, args);
3937
}
40-
41-
class Disposable : IDisposable
42-
{
43-
private readonly IDisposable _disposable;
44-
private readonly Action<long> _action;
45-
private readonly Stopwatch _sw;
46-
47-
public Disposable(IDisposable disposable, Action<long> action)
48-
{
49-
_disposable = disposable;
50-
_action = action;
51-
_sw = new Stopwatch();
52-
_sw.Start();
53-
}
54-
55-
public void Dispose()
56-
{
57-
_sw.Stop();
58-
_action(_sw.ElapsedMilliseconds);
59-
_disposable.Dispose();
60-
}
61-
}
62-
63-
/// <summary>
64-
/// Times the trace.
65-
/// </summary>
66-
/// <param name="logger">The logger.</param>
67-
/// <param name="message">The message.</param>
68-
/// <param name="args">The arguments.</param>
69-
/// <returns>IDisposable.</returns>
70-
internal static IDisposable TimeTrace(this ILogger logger, string message, params object[] args)
71-
{
72-
var scope = logger.BeginScope(new { });
73-
logger.LogTrace($"Starting: {message}", args);
74-
return new Disposable(scope, elapsed =>
75-
{
76-
var a = args.Concat(new object[] { elapsed }).ToArray();
77-
logger.LogTrace($"Finished: {message} in {{ElapsedMilliseconds}}ms", a);
78-
});
79-
}
80-
81-
/// <summary>
82-
/// Times the debug.
83-
/// </summary>
84-
/// <param name="logger">The logger.</param>
85-
/// <param name="message">The message.</param>
86-
/// <param name="args">The arguments.</param>
87-
/// <returns>IDisposable.</returns>
88-
internal static IDisposable TimeDebug(this ILogger logger, string message, params object[] args)
89-
{
90-
var scope = logger.BeginScope(new { });
91-
logger.LogDebug($"Starting: {message}", args);
92-
return new Disposable(scope, elapsed =>
93-
{
94-
var a = args.Concat(new object[] { elapsed }).ToArray();
95-
logger.LogDebug($"Finished: {message} in {{ElapsedMilliseconds}}ms", a);
96-
});
97-
}
98-
99-
/// <summary>
100-
/// Times the information.
101-
/// </summary>
102-
/// <param name="logger">The logger.</param>
103-
/// <param name="message">The message.</param>
104-
/// <param name="args">The arguments.</param>
105-
/// <returns>IDisposable.</returns>
106-
internal static IDisposable TimeInformation(this ILogger logger, string message, params object[] args)
107-
{
108-
var scope = logger.BeginScope(new { });
109-
logger.LogInformation($"Starting: {message}", args);
110-
return new Disposable(scope, elapsed =>
111-
{
112-
var a = args.Concat(new object[] { elapsed }).ToArray();
113-
logger.LogInformation($"Finished: {message} in {{ElapsedMilliseconds}}ms", a);
114-
});
115-
}
11638
}
11739
}

0 commit comments

Comments
 (0)