From d9d88545f83aa939eede9e5231004f6731647da1 Mon Sep 17 00:00:00 2001 From: Hertzole Date: Sun, 15 Nov 2020 05:53:57 +0100 Subject: [PATCH] LogCalled can now include class name. --- Editor/Processors/LogCalledProcessor.cs | 2 ++ Editor/Settings/CecilAttributesSettings.cs | 2 +- Editor/Settings/CecilAttributesSettingsGUI.cs | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Editor/Processors/LogCalledProcessor.cs b/Editor/Processors/LogCalledProcessor.cs index 80fbfdd..6cc025c 100644 --- a/Editor/Processors/LogCalledProcessor.cs +++ b/Editor/Processors/LogCalledProcessor.cs @@ -90,6 +90,8 @@ private static bool ProcessMethods(TypeDefinition type, ModuleDefinition module) instructions.Clear(); sb.Append(methodFormat); + sb.Replace("%class%", type.Name); + sb.Replace("%CLASS%", type.Name.ToUpperInvariant()); sb.Replace("%method%", method.Name); sb.Replace("%METHOD%", method.Name.ToUpperInvariant()); diff --git a/Editor/Settings/CecilAttributesSettings.cs b/Editor/Settings/CecilAttributesSettings.cs index 020d937..df05432 100644 --- a/Editor/Settings/CecilAttributesSettings.cs +++ b/Editor/Settings/CecilAttributesSettings.cs @@ -17,7 +17,7 @@ public class CecilAttributesSettings : ScriptableObject [SerializeField] private bool includeLogsInBuild = true; [SerializeField] - private string methodLogFormat = "%method% (%parameters%)"; + private string methodLogFormat = "%class% %method% (%parameters%)"; [SerializeField] private string parametersSeparator = ", "; [SerializeField] diff --git a/Editor/Settings/CecilAttributesSettingsGUI.cs b/Editor/Settings/CecilAttributesSettingsGUI.cs index 7942a9f..4a7b5b3 100644 --- a/Editor/Settings/CecilAttributesSettingsGUI.cs +++ b/Editor/Settings/CecilAttributesSettingsGUI.cs @@ -76,6 +76,7 @@ private static void OnLogCalledSection() EditorGUILayout.HelpBox("You can format each message to fit your needs. There are some special keywords that can be useful for you.\n" + "All keywords have an to upper variant. For example: %method% -> %METHOD% turns MyMethod into MYMETHOD.\n" + + "%class% - Class name\n" + "%method% - Method name\n" + "%parameters% - List of parameters\n" + "%property% - Property name\n" +