mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-15 21:24:16 +01:00
feat: Add LogRaw to PluginLog
Adds the ability to send a log message to Serilog specifying a log level at runtime. This feature is primarily aimed at allowing developers to easily bridge disparate logging systems without hardcoding log level calls.
This commit is contained in:
parent
e8d106795d
commit
d57eba7f63
1 changed files with 14 additions and 0 deletions
|
|
@ -240,6 +240,20 @@ public static class PluginLog
|
|||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Log a message to the in-game log, setting level at runtime.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This method is primarily meant for interoperability with other logging systems that may want to be forwarded to
|
||||
/// the PluginLog.
|
||||
/// </remarks>
|
||||
/// <param name="level">The log level for this message.</param>
|
||||
/// <param name="exception">An exception (if any) to include in this log message.</param>
|
||||
/// <param name="messageTemplate">The message template.</param>
|
||||
/// <param name="values">Values to log.</param>
|
||||
public static void LogRaw(LogEventLevel level, Exception? exception, string messageTemplate, params object[] values)
|
||||
=> WriteLog(Assembly.GetCallingAssembly().GetName().Name, level, messageTemplate, exception, values);
|
||||
|
||||
private static ILogger GetPluginLogger(string? pluginName)
|
||||
{
|
||||
return Serilog.Log.ForContext("SourceContext", pluginName ?? string.Empty);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue