GT Log
A universal, reusable logging system for Unity. Replaces Debug.Log with structured, filterable, extensible logging.
com.gt.log 
Install via UPM
Add to Unity Package Manager using this URL
https://www.pkglnk.dev/log.git README Markdown
Copy this to your project's README.md
## Installation
Add **GT Log** to your Unity project via Package Manager:
1. Open **Window > Package Manager**
2. Click **+** > **Add package from git URL**
3. Enter:
```
https://www.pkglnk.dev/log.git
```
[](https://www.pkglnk.dev/pkg/log)README
GT Log
A universal, reusable logging system for Unity. Replaces Debug.Log with structured, filterable, extensible logging.
Distributed as a UPM package — install in any Unity project via Git URL.
Installation
Via Git URL (Unity Package Manager)
- Open Window → Package Manager
- Click + → Add package from git URL...
- Paste:
https://github.com/TelmanArm/gt-log.git - Click Add
Requirements
- Unity 2021.3 or later
Quick Start
using GT.Log;
// Basic logging — defaults to LogTag.General
GTLog.Info("Game started");
GTLog.Warning("Low memory");
GTLog.Error("Failed to load save file");
// Logging with predefined tags (type-safe, IDE autocomplete)
GTLog.Info("Connected to server", LogTag.Network);
GTLog.Warning("Path recalculated", LogTag.AI);
GTLog.Debug("Button clicked", LogTag.UI);
GTLog.Info("Boat moved", LogTag.Gameplay);
// Custom string tags (for anything not in LogTag enum)
GTLog.Info("Custom event fired", "MY_SYSTEM");
// Set minimum log level
GTLog.SetMinLevel(LogLevel.Warning); // only Warning, Error, Critical
// Disable a tag — all Network messages are hidden
GTLog.SetTagEnabled(LogTag.Network, false);
Log Levels
| Level | Value | Description |
|---|---|---|
Trace |
0 | Most verbose, fine-grained diagnostics |
Debug |
1 | Development-time debug information |
Info |
2 | General informational messages |
Warning |
3 | Potential issues that aren't errors |
Error |
4 | Errors that allow the app to continue |
Critical |
5 | Fatal errors, app may crash |
None |
6 | Filter level to suppress all logging |
Log Tags
Predefined subsystem categories. Each tag can be toggled on/off independently.
| Tag | Description |
|---|---|
General |
Default — messages without a specific subsystem |
Gameplay |
Game mechanics, rules, scoring |
UI |
User interface, menus, HUD |
Network |
Networking, multiplayer |
Audio |
Sound effects, music |
Physics |
Physics, collisions |
AI |
Artificial intelligence, pathfinding |
Input |
Player input, controls |
System |
App lifecycle, bootstrap |
Usage:
GTLog.Info("Menu opened", LogTag.UI); // predefined tag
GTLog.Info("Something happened"); // defaults to LogTag.General
GTLog.Info("Custom thing", "MY_CUSTOM_TAG"); // custom string tag (always shown)
If no tag is passed, LogTag.General is used. When General is disabled in the editor, untagged messages are hidden.
Custom string tags are not filtered by the tag system — they always pass through.
Level Filtering
Minimum Level
Discard everything below a threshold:
GTLog.SetMinLevel(LogLevel.Warning); // only Warning, Error, Critical
GTLog.SetMinLevel(LogLevel.Trace); // show everything (default)
GTLog.SetMinLevel(LogLevel.None); // suppress all logging
Per-Level Toggles
Enable or disable individual levels independently:
GTLog.SetLevelEnabled(LogLevel.Trace, false);
if (GTLog.IsLevelEnabled(LogLevel.Debug)) { /* … */ }
GTLog.EnableAllLevels();
GTLog.DisableAllLevels();
Tag Filtering
Toggle predefined tags on/off. Disabled tags are silently discarded.
// Hide all Network messages (every level)
GTLog.SetTagEnabled(LogTag.Network, false);
// Show them again
GTLog.SetTagEnabled(LogTag.Network, true);
// Check
if (GTLog.IsTagEnabled(LogTag.UI)) { /* … */ }
// Bulk
GTLog.EnableAllTags();
GTLog.DisableAllTags();
Tags can also be toggled from the Editor Window (GT Tools → GT-Log).
Global Tag
Set a global tag that appears in every log entry (e.g. to identify your app):
GTLog.SetGlobalTag("DOWNSTREAM");
// Output: [INFO] [NETWORK] [DOWNSTREAM] Connected to server
GTLog.SetGlobalTag(""); // remove global tag
string tag = GTLog.GetGlobalTag();
The global tag appears after the per-call tag.
To hide the global tag from output without removing it:
GTLog.SetShowGlobalTag(false); // [DOWNSTREAM] disappears from output
GTLog.SetShowGlobalTag(true); // [DOWNSTREAM] reappears
bool showing = GTLog.GetShowGlobalTag(); // check current visibility
This can also be toggled from the Editor Window — uncheck the "Show Global Tag" toggle above the Global Tag field.
Output Format
Default format using SimpleTextFormatter (Unity rich text):
[INFO] Connected to server
[WARN] [NETWORK] Packet loss detected
[INFO] [UI] [DOWNSTREAM] Menu opened
[ERROR] Failed to load save file
Each level is color-coded in the Unity Console:
| Level | Color |
|---|---|
Trace |
Purple |
Debug |
Light Blue |
Info |
Green |
Warning |
Yellow |
Error |
Red |
Critical |
Dark Red |
With a per-call tag and a global tag the format is:
[LEVEL] [Tag] [GlobalTag] Message
LogTag.General produces no [Tag] segment — output is clean.
Custom Outputs
Implement ILogOutput to send logs anywhere:
using GT.Log;
public class MyCustomOutput : ILogOutput
{
public void Write(LogEntry entry)
{
// Send to your analytics, file, server, etc.
}
}
// Register it
GTLog.AddOutput(new MyCustomOutput());
Managing outputs:
GTLog.RemoveOutput(myOutput);
GTLog.ClearOutputs(); // remove all outputs (including default)
GTLog.Reset(); // clear everything, re-initialize defaults
Custom Formatters
Implement ILogFormatter to change how log entries are converted to strings:
using GT.Log;
public class MyFormatter : ILogFormatter
{
public string Format(LogEntry entry)
{
return $"[{entry.Timestamp:HH:mm:ss}] {entry.Level}: {entry.Message}";
}
}
To use a custom formatter, pass it to UnityConsoleOutput and register that output:
using GT.Log;
using GT.Log.Outputs;
GTLog.ClearOutputs();
GTLog.AddOutput(new UnityConsoleOutput(new MyFormatter()));
Editor Window
Open GT Tools → GT-Log to access the log control panel.
The window lets you:
- Toggle individual log levels on/off with color-coded indicators
- Level quick actions — All On, All Off, Errors Only
- Toggle predefined tags on/off (General, Gameplay, UI, Network, Audio, Physics, AI, Input, System)
- Tag quick actions — All Tags On, All Tags Off
- Set the Global Tag from the editor, with a Show checkbox to toggle its visibility
All settings are saved in EditorPrefs and persist across Unity sessions. They are applied automatically when the editor loads, before any scene code runs.
License
Comments
No comments yet. Be the first!
Sign in to join the conversation
Sign In