Skip to content

Log Channel

pixeption edited this page Oct 22, 2021 · 3 revisions

Log channel or log tag is a way that help you classify your log. Imagine you're developing a feature, you put some logs and interest only those logs, however the log view will be flooded with other logs from other features/system. This is when Log Channel comes to rescue.

Usage

By default, the log format is [channel name]. You can add multiple channels in a log by separator character ,, example [Renderer, Material]

To print a log with channel, you can use Unity debug log or built-in log that comes with Mobile Console:

  • Unity log: UnityEngine.Debug.Log("[Renderer] message...");
  • Built-in log: Log.Debug("[Renderer] message..."); or Log.DebugChannel("Renderer", "message...");

Filter Log channel

To filter log channel, tap on the log channel icon next to Log Filter

  • Enable new channel by default: as channels are added dynamically, should it enable or disable
  • Show non-channel logs: should log without channels are filtered out
  • Enable all: Enable all log channels, also enable new channel by default
  • Disable all: Disable all log channels, also disable new channel by default

Channel color

Channel color is calculated by its name (using hash) and consistent as long as the name is unchanged

Customize

You can customize the channel syntax in LogConsoleSettings located at Assets/Mobile Console/Resources/LogConsoleSettings.asset. You can change

  • Channel format (default: [{0}]): can change to #{0}# or similar. Please note that we use Regex to parse channel so not all character will work
  • Channel separator (default: ",")