mirror of
https://github.com/goatcorp/Dalamud.git
synced 2026-02-16 21:07:43 +01:00
feat: Allow /xldev to disable Safe Mode (#2166)
- Adds new menu item to /xldev to disable Safe Mode, allowing users to load plugins again. - Safe mode cannot be re-enabled once disabled. - Add new ModuleLog.Create<T> for eventual ILogger magic - Make safe mode writable - Remove redundant check in CheckPolicy
This commit is contained in:
parent
da8be03124
commit
a656fefb2b
4 changed files with 38 additions and 13 deletions
|
|
@ -1,5 +1,6 @@
|
|||
using Serilog;
|
||||
using Serilog.Core;
|
||||
using Serilog.Core.Enrichers;
|
||||
using Serilog.Events;
|
||||
|
||||
namespace Dalamud.Logging.Internal;
|
||||
|
|
@ -11,7 +12,7 @@ public class ModuleLog
|
|||
{
|
||||
private readonly string moduleName;
|
||||
private readonly ILogger moduleLogger;
|
||||
|
||||
|
||||
// FIXME (v9): Deprecate this class in favor of using contextualized ILoggers with proper formatting.
|
||||
// We can keep this class around as a Serilog helper, but ModuleLog should no longer be a returned
|
||||
// type, instead returning a (prepared) ILogger appropriately.
|
||||
|
|
@ -27,6 +28,28 @@ public class ModuleLog
|
|||
this.moduleLogger = Log.ForContext("Dalamud.ModuleName", this.moduleName);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ModuleLog"/> class.
|
||||
/// This class will properly attach SourceContext and other attributes per Serilog standards.
|
||||
/// </summary>
|
||||
/// <param name="type">The type of the class this logger is for.</param>
|
||||
public ModuleLog(Type type)
|
||||
{
|
||||
this.moduleName = type.Name;
|
||||
this.moduleLogger = Log.ForContext(
|
||||
[
|
||||
new PropertyEnricher(Constants.SourceContextPropertyName, type.FullName),
|
||||
new PropertyEnricher("Dalamud.ModuleName", this.moduleName)
|
||||
]);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Helper method to create a new <see cref="ModuleLog"/> instance based on a type.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The class to create this ModuleLog for.</typeparam>
|
||||
/// <returns>Returns a ModuleLog with name set.</returns>
|
||||
internal static ModuleLog Create<T>() => new(typeof(T));
|
||||
|
||||
/// <summary>
|
||||
/// Log a templated verbose message to the in-game debug log.
|
||||
/// </summary>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue