Skip to content

Commit

Permalink
Add global logger to templates (#2)
Browse files Browse the repository at this point in the history
Co-authored-by: ManlyMarco <[email protected]>
  • Loading branch information
PhantomGamers and ManlyMarco authored Aug 21, 2023
1 parent 32b23b1 commit 9d628c6
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 0 deletions.
3 changes: 3 additions & 0 deletions BepInEx.Templates/templates/BepInEx5.PluginTemplate/Plugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,12 @@ namespace BepInEx5.PluginTemplate;
[BepInPlugin(MyPluginInfo.PLUGIN_GUID, MyPluginInfo.PLUGIN_NAME, MyPluginInfo.PLUGIN_VERSION)]
public class Plugin : BaseUnityPlugin
{
internal static new ManualLogSource Logger;

private void Awake()
{
// Plugin startup logic
this.Logger = Logger;
Logger.LogInfo($"Plugin {MyPluginInfo.PLUGIN_GUID} is loaded!");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,12 @@ namespace BepInEx6.PluginTemplate.NET.CoreCLR;
[BepInPlugin(MyPluginInfo.PLUGIN_GUID, MyPluginInfo.PLUGIN_NAME, MyPluginInfo.PLUGIN_VERSION)]
public class Plugin : BasePlugin
{
internal static new ManualLogSource Log;

public override void Load()
{
// Plugin startup logic
this.Log = base.Log;
Log.LogInfo($"Plugin {MyPluginInfo.PLUGIN_GUID} is loaded!");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,12 @@ namespace BepInEx6.PluginTemplate.NET.Framework;
[BepInPlugin(MyPluginInfo.PLUGIN_GUID, MyPluginInfo.PLUGIN_NAME, MyPluginInfo.PLUGIN_VERSION)]
public class Plugin : BasePlugin
{
internal static new ManualLogSource Log;

public override void Load()
{
// Plugin startup logic
this.Log = base.Log;
Log.LogInfo($"Plugin {MyPluginInfo.PLUGIN_GUID} is loaded!");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,12 @@ namespace BepInEx6.PluginTemplate.Unity.Il2Cpp;
[BepInPlugin(MyPluginInfo.PLUGIN_GUID, MyPluginInfo.PLUGIN_NAME, MyPluginInfo.PLUGIN_VERSION)]
public class Plugin : BasePlugin
{
internal static new ManualLogSource Log;

public override void Load()
{
// Plugin startup logic
this.Log = base.Log;
Log.LogInfo($"Plugin {MyPluginInfo.PLUGIN_GUID} is loaded!");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,12 @@ namespace BepInEx6.PluginTemplate.Unity.Mono;
[BepInPlugin(MyPluginInfo.PLUGIN_GUID, MyPluginInfo.PLUGIN_NAME, MyPluginInfo.PLUGIN_VERSION)]
public class Plugin : BaseUnityPlugin
{
internal static new ManualLogSource Logger;

private void Awake()
{
// Plugin startup logic
this.Logger = base.Logger;
Logger.LogInfo($"Plugin {MyPluginInfo.PLUGIN_GUID} is loaded!");
}
}

0 comments on commit 9d628c6

Please sign in to comment.