-
Notifications
You must be signed in to change notification settings - Fork 40
Add Debug to properties.yml #364
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 4 commits
d4605ec
e20e02b
408d736
62a1b99
77a119e
27c65e8
40479d9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -22,12 +22,31 @@ public static class Logger | |
| /// <param name="color">The color of the message.</param> | ||
| public static void Raw(string message, ConsoleColor color) => ServerConsole.AddLog(message, color); | ||
|
|
||
| /// <summary> | ||
| /// An O(1) set of Assemblies that should display Debug messages. | ||
| /// Populated automatically by <see cref="LabApi.Loader.Features.Plugins.Configuration.Properties.Debug"/> | ||
|
tayjay marked this conversation as resolved.
Outdated
|
||
| /// </summary> | ||
| public static System.Collections.Generic.HashSet<Assembly> DebugEnabled { get; } = new(); | ||
|
|
||
| /// <summary> | ||
| /// Logs a debug message to the server console. | ||
| /// Checks <see cref="DebugEnabled"/> before sending the message. | ||
| /// </summary> | ||
| /// <param name="message">The message to log.</param> | ||
| public static void Debug(object message) => Debug( | ||
| message, | ||
| Loader.PluginLoader.Config?.DebugOverride == true || DebugEnabled.Contains(Assembly.GetCallingAssembly())); | ||
|
|
||
| /// <summary> | ||
| /// Logs a debug message to the server console. | ||
| /// </summary> | ||
| /// <param name="message">The message to log.</param> | ||
| /// <param name="canBePrinted">Whether the message can be printed.</param> | ||
| public static void Debug(object message, bool canBePrinted = true) | ||
| /// <remarks> | ||
| /// Uses explicit <paramref name="canBePrinted"/>. | ||
| /// Can be replaced with the single parameter overload to use <see cref="LabApi.Loader.Features.Plugins.Configuration.Properties.Debug"/> Property instead. | ||
|
tayjay marked this conversation as resolved.
Outdated
|
||
| /// </remarks> | ||
| public static void Debug(object message, bool canBePrinted) | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Forcing a parameter on devs is in fact, breaking change.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The overloaded Debug method on line 36 will be used if only 1 parameter is provided. So it is not forced, just explicitly defined. Plugins that are already built will have the default "true" parameter included automatically and the IL will point them to |
||
| { | ||
| if (!canBePrinted) | ||
| { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -27,4 +27,11 @@ public class LabApiConfig | |
| /// <seealso cref="LabApi.Loader.Features.Plugins.Configuration.Properties.UnsupportedLoading"/> | ||
| [Description("Whether to allow loading plugins even if they were built for a different major version of LabAPI.")] | ||
| public bool LoadUnsupportedPlugins { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Whether debug logs should appear regardless of pre-plugin properties. | ||
| /// </summary> | ||
| /// <seealso cref="LabApi.Loader.Features.Plugins.Configuration.Properties.Debug"/> | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See line 27, was following the same way LoadUnsupportedPlugins was commented. |
||
| [Description("Whether debug logs should be printed regardless of per-plugin properties. Only recommended during Plugin development.")] | ||
| public bool DebugOverride { get; set; } = false; | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.