This script provides a simple and consistent way for Callout/Plugin developers to log important information to a log file for debugging purposes. By integrating this logging manager into your scripts, you can easily trace execution, diagnose issues, and record detailed information about your plugin's behavior.
- Easy Integration: Add a single line to your existing code to start logging.
- Consistent Output: Ensures all your plugin logs follow a clear format for easier identification.
- Works with Existing Logging: Designed to supplement your use of
Game.LogTrivialor similar logging methods. - Customizable Messages: Prepend your plugin name to every log entry for quick identification.
Import the script int your project
Find any occurrence of Game.LogTrivial within your plugin or callout script. For example:
Game.LogTrivial("Some important information about your plugin's process.");Immediately after your Game.LogTrivial code, add the following line:
LoggingManager.Log("YOUR PLUGIN NAME [LOG]:");Replace YOUR PLUGIN NAME with the actual name of your plugin or callout for clarity.
Example:
Game.LogTrivial("Starting plugin initialization...");
LoggingManager.Log("MyAwesomePlugin [LOG]: Starting initialization");After adding the LoggingManager.Log statement, save your script file.
That's it!
Your plugin will now generate additional log entries, making it easier to debug and trace its activity.
public void Initialize()
{
Game.LogTrivial("Initializing plugin...");
LoggingManager.Log("TrafficControl [LOG]: Initialization started");
// Plugin logic here
}- Use descriptive log messages to make debugging easier.
- Always prepend your plugin name in the log for clear separation in shared log files.
- You can add multiple
LoggingManager.Logstatements throughout your codebase to track different events.
- If logs do not appear, ensure
LoggingManageris properly referenced and initialized in your project. - Check file permissions for the log directory to ensure the log file can be written.
Feel free to submit improvements, bug fixes, or feature requests via pull requests.
Distributed under the MIT License. See LICENSE for more information.