Skip to content

Commit d7ea2f1

Browse files
committed
misc: remove legacy log documentation for Log.Legacy.cs
1 parent afb2a2a commit d7ea2f1

File tree

1 file changed

+0
-129
lines changed

1 file changed

+0
-129
lines changed

Yubico.Core/src/Yubico/Core/Logging/Log.Legacy.cs

Lines changed: 0 additions & 129 deletions
Original file line numberDiff line numberDiff line change
@@ -18,109 +18,10 @@
1818

1919
namespace Yubico.Core.Logging
2020
{
21-
/// <summary>
22-
/// A static class for managing Yubico SDK logging for this process.
23-
/// </summary>
24-
/// <remarks>
25-
/// <para>
26-
/// This class is used for managing the active logger used globally by .NET-based Yubico SDKs in the current process.
27-
/// Changing the settings in this class will not have any effect on applications or services that are not running
28-
/// within the current application's process. It will affect all libraries contained within - for example, changing
29-
/// the logger factory here will impact both the Yubico.YubiKey and Yubico.Core libraries.
30-
/// </para>
31-
/// <para>
32-
/// The <see cref="LoggerFactory"/> property is used to set and control the concrete log to be used by the SDK. By
33-
/// default, we send logs to the "null" logger - effectively disabling logging. If you set this property with your
34-
/// own logger factory, the SDK will use this log from the point of the set until someone calls this set method again.
35-
/// </para>
36-
/// <para>
37-
/// <see cref="GetLogger()"/> should be used to return an instance of the <see cref="Logger"/> class. This is the object
38-
/// used to actually write the log messages. It is generally OK to cache an instance of a logger within another
39-
/// class instance. Holding a Logger instance open longer than that is not recommended, as changes to the LoggerFactory
40-
/// will not be reflected until you call the `GetLogger` method again.
41-
/// </para>
42-
/// </remarks>
4321
public static partial class Log
4422
{
4523
private static ILoggerFactory? _factory;
4624

47-
/// <summary>
48-
/// The logger factory implementation that should be used by the SDK. Use this to set the active logger.
49-
/// </summary>
50-
/// <remarks>
51-
/// <para>
52-
/// The LoggerFactory controls how the concrete log(s) that the SDK will use get created. This is something that
53-
/// should be controlled by the application using the SDK, and not the SDK itself. The application can decide
54-
/// whether they would like to send events to the Windows Event Log, or to a cross platform logger such as NLog,
55-
/// Serilog, or others. An application can decide to send log messages to multiple sinks as well (see examples).
56-
/// </para>
57-
/// <para>
58-
/// The <see cref="ILoggerFactory"/> interface is the same one that is used by `Microsoft.Extensions.Logging.` You
59-
/// can read more about how to integrate with this interface in the
60-
/// [Logging in .NET](https://docs.microsoft.com/en-us/dotnet/core/extensions/logging) webpage provided by Microsoft.
61-
/// </para>
62-
/// </remarks>
63-
/// <example>
64-
/// <para>
65-
/// Send SDK log messages to the console:
66-
/// </para>
67-
/// <code language="csharp">
68-
/// using Microsoft.Extensions.Logging;
69-
/// using Yubico.Core.Logging;
70-
///
71-
/// static class Program
72-
/// {
73-
/// static void EnableLogging()
74-
/// {
75-
/// Log.LoggerFactory = LoggerFactory.Create(
76-
/// builder => builder.AddSimpleConsole(
77-
/// options =>
78-
/// {
79-
/// options.IncludeScopes = true;
80-
/// options.SingleLine = true;
81-
/// options.TimestampFormat = "hh:mm:ss";
82-
/// })
83-
/// .AddFilter(level => level >= LogLevel.Information));
84-
/// }
85-
/// }
86-
/// </code>
87-
/// </example>
88-
/// <example>
89-
/// <para>
90-
/// Send SDK log messages to Serilog.
91-
/// </para>
92-
/// <para>
93-
/// First, begin by adding a package reference to `Serilog.Extensions.Logging` and `Serilog.Sinks.Console` (or
94-
/// to the appropriate sink you plan to use).
95-
/// </para>
96-
/// <para>
97-
/// Now, you can add the following code to your application:
98-
/// </para>
99-
/// <code language="csharp">
100-
/// using Microsoft.Extensions.Logging;
101-
/// using Serilog;
102-
/// using Yubico.Core.Logging;
103-
///
104-
/// static class Program
105-
/// {
106-
/// static void EnableLogging()
107-
/// {
108-
/// // Serilog does setup through its own LoggerConfiguration builder. The factory will
109-
/// // pick up the log from Serilog.Log.Logger.
110-
/// Serilog.Log.Logger = new LoggerConfiguration()
111-
/// .Enrich().FromLogContext()
112-
/// .WriteTo.Console()
113-
/// .CreateLogger();
114-
///
115-
/// // Fully qualified name to avoid conflicts with Serilog types
116-
/// Yubico.Core.Logging.Log.LoggerFactory = LoggerFactory.Create(
117-
/// builder => builder
118-
/// .AddSerilog(dispose: true)
119-
/// .AddFilter(level => level >= LogLevel.Information));
120-
/// }
121-
/// }
122-
/// </code>
123-
/// </example>
12425
[Obsolete("Obsolete, use Log.Instance instead. Setting this will override the default dotnet console logger.")]
12526
public static ILoggerFactory LoggerFactory
12627
{
@@ -134,36 +35,6 @@ public static ILoggerFactory LoggerFactory
13435
}
13536
}
13637

137-
/// <summary>
138-
/// Gets an instance of the active logger.
139-
/// </summary>
140-
/// <returns>
141-
/// An instance of the active concrete logger.
142-
/// </returns>
143-
/// <example>
144-
/// <para>
145-
/// Write some information to the log.
146-
/// </para>
147-
/// <code language="csharp">
148-
/// using Yubico.Core.Logging;
149-
///
150-
/// public class Example
151-
/// {
152-
/// private Logger _log = Log.GetLogger();
153-
///
154-
/// public void SampleMethod()
155-
/// {
156-
/// _log.LogDebug("The SampleMethod method has been called!");
157-
/// }
158-
///
159-
/// public void StaticMethod()
160-
/// {
161-
/// Logger log = Log.GetLogger(); // Can't use the instance logger because we're static.
162-
/// log.LogDebug("Called from a static method!");
163-
/// }
164-
/// }
165-
/// </code>
166-
/// </example>
16738
[Obsolete("Obsolete, use equivalent ILogger method, or view the changelog for further instruction.")]
16839
public static Logger GetLogger() => new Logger(Yubico.Core.Logging.Log.LoggerFactory.CreateLogger("Yubico.Core logger"));
16940
}

0 commit comments

Comments
 (0)