From d7ea2f135418a0cb2f92d043b59f163ea08bdf1c Mon Sep 17 00:00:00 2001 From: Dennis Dyallo Date: Thu, 9 Jan 2025 16:39:08 +0100 Subject: [PATCH] misc: remove legacy log documentation for Log.Legacy.cs --- .../src/Yubico/Core/Logging/Log.Legacy.cs | 129 ------------------ 1 file changed, 129 deletions(-) diff --git a/Yubico.Core/src/Yubico/Core/Logging/Log.Legacy.cs b/Yubico.Core/src/Yubico/Core/Logging/Log.Legacy.cs index b4d78aa8..d438583f 100644 --- a/Yubico.Core/src/Yubico/Core/Logging/Log.Legacy.cs +++ b/Yubico.Core/src/Yubico/Core/Logging/Log.Legacy.cs @@ -18,109 +18,10 @@ namespace Yubico.Core.Logging { - /// - /// A static class for managing Yubico SDK logging for this process. - /// - /// - /// - /// This class is used for managing the active logger used globally by .NET-based Yubico SDKs in the current process. - /// Changing the settings in this class will not have any effect on applications or services that are not running - /// within the current application's process. It will affect all libraries contained within - for example, changing - /// the logger factory here will impact both the Yubico.YubiKey and Yubico.Core libraries. - /// - /// - /// The property is used to set and control the concrete log to be used by the SDK. By - /// default, we send logs to the "null" logger - effectively disabling logging. If you set this property with your - /// own logger factory, the SDK will use this log from the point of the set until someone calls this set method again. - /// - /// - /// should be used to return an instance of the class. This is the object - /// used to actually write the log messages. It is generally OK to cache an instance of a logger within another - /// class instance. Holding a Logger instance open longer than that is not recommended, as changes to the LoggerFactory - /// will not be reflected until you call the `GetLogger` method again. - /// - /// public static partial class Log { private static ILoggerFactory? _factory; - /// - /// The logger factory implementation that should be used by the SDK. Use this to set the active logger. - /// - /// - /// - /// The LoggerFactory controls how the concrete log(s) that the SDK will use get created. This is something that - /// should be controlled by the application using the SDK, and not the SDK itself. The application can decide - /// whether they would like to send events to the Windows Event Log, or to a cross platform logger such as NLog, - /// Serilog, or others. An application can decide to send log messages to multiple sinks as well (see examples). - /// - /// - /// The interface is the same one that is used by `Microsoft.Extensions.Logging.` You - /// can read more about how to integrate with this interface in the - /// [Logging in .NET](https://docs.microsoft.com/en-us/dotnet/core/extensions/logging) webpage provided by Microsoft. - /// - /// - /// - /// - /// Send SDK log messages to the console: - /// - /// - /// using Microsoft.Extensions.Logging; - /// using Yubico.Core.Logging; - /// - /// static class Program - /// { - /// static void EnableLogging() - /// { - /// Log.LoggerFactory = LoggerFactory.Create( - /// builder => builder.AddSimpleConsole( - /// options => - /// { - /// options.IncludeScopes = true; - /// options.SingleLine = true; - /// options.TimestampFormat = "hh:mm:ss"; - /// }) - /// .AddFilter(level => level >= LogLevel.Information)); - /// } - /// } - /// - /// - /// - /// - /// Send SDK log messages to Serilog. - /// - /// - /// First, begin by adding a package reference to `Serilog.Extensions.Logging` and `Serilog.Sinks.Console` (or - /// to the appropriate sink you plan to use). - /// - /// - /// Now, you can add the following code to your application: - /// - /// - /// using Microsoft.Extensions.Logging; - /// using Serilog; - /// using Yubico.Core.Logging; - /// - /// static class Program - /// { - /// static void EnableLogging() - /// { - /// // Serilog does setup through its own LoggerConfiguration builder. The factory will - /// // pick up the log from Serilog.Log.Logger. - /// Serilog.Log.Logger = new LoggerConfiguration() - /// .Enrich().FromLogContext() - /// .WriteTo.Console() - /// .CreateLogger(); - /// - /// // Fully qualified name to avoid conflicts with Serilog types - /// Yubico.Core.Logging.Log.LoggerFactory = LoggerFactory.Create( - /// builder => builder - /// .AddSerilog(dispose: true) - /// .AddFilter(level => level >= LogLevel.Information)); - /// } - /// } - /// - /// [Obsolete("Obsolete, use Log.Instance instead. Setting this will override the default dotnet console logger.")] public static ILoggerFactory LoggerFactory { @@ -134,36 +35,6 @@ public static ILoggerFactory LoggerFactory } } - /// - /// Gets an instance of the active logger. - /// - /// - /// An instance of the active concrete logger. - /// - /// - /// - /// Write some information to the log. - /// - /// - /// using Yubico.Core.Logging; - /// - /// public class Example - /// { - /// private Logger _log = Log.GetLogger(); - /// - /// public void SampleMethod() - /// { - /// _log.LogDebug("The SampleMethod method has been called!"); - /// } - /// - /// public void StaticMethod() - /// { - /// Logger log = Log.GetLogger(); // Can't use the instance logger because we're static. - /// log.LogDebug("Called from a static method!"); - /// } - /// } - /// - /// [Obsolete("Obsolete, use equivalent ILogger method, or view the changelog for further instruction.")] public static Logger GetLogger() => new Logger(Yubico.Core.Logging.Log.LoggerFactory.CreateLogger("Yubico.Core logger")); }