Understanding Jahro Logs

Your Debugging Ally in Unity

Introduction

Jahro logs are all about catching and controlling Unity's Debug logs in a convenient and powerful way. They equip you with the ability to log custom messages using Jahro's custom Log interface (Jahro.Log()). The best part? You can see these logs directly in your game build, making the troubleshooting process more streamlined than ever!

But that's not all. Jahro logs also allow you to see the results of your commands, visualize different log levels with unique colors, and even share specific logs with your team. This makes Jahro logs not only an essential debugging tool, but also a helpful communication medium.

Understanding Jahro Logs

Jahro logs help in intercepting Unity Debug logs and present them to you in a neat and organized way via Jahro's custom Log interface.

Jahro logs come in various types, each with its unique color and purpose:

  1. Debug Logs
  2. Warning Logs
  3. Error Logs
  4. Exception Logs

But Jahro logs are not just about capturing logs. They also provide a powerful way to log custom messages with Jahro.Log() method.

Executing Jahro Logs

Running Jahro logs is as straightforward as calling a method. Jahro provides a set of API methods that allows you to generate different types of logs. They are: Log, LogDebug, LogWarning, LogException, and LogError.

Let's take a look at each one of them and see how we can execute them:

  • Log: This is a general-purpose log for displaying any kind of message. You can use it for keeping track of game events, recording user actions, or any other informational messages.

Jahro.Log("Game started");
You can also add details to your log message, which will be displayed in an expanded state:

Jahro.Log("Player jumped", "Player jumped at position: " + player.position);
  • LogDebug: If you need more granular information about what's happening in your game, particularly during the development phase, you can use LogDebug. It functions the same way as Log:

Jahro.LogDebug("Debug: Checking player position");
  • LogWarning: Use this when something unusual occurs in your game, but it's not a showstopper. It's perfect for highlighting potential issues:

if(player.health < 0)
{
    Jahro.LogWarning("Warning: Player health is below 0");
}
  • LogError: When there's an issue that could potentially break your game, use LogError:

if(player == null)
{
    Jahro.LogError("Error: Player object not found");
}
  • LogException: Jahro also helps you to capture any unexpected exceptions in your code:

try
{
    // Some code that might throw an exception
}
catch(Exception e)
{
    Jahro.LogException(e);
}
Each log level has its unique color and serves a specific purpose, helping you to easily spot and address issues during your game development. Happy logging!

Filtering Logs

Jahro's user-friendly interface allows you to filter logs based on their type: Commands, Debug, Warning, Exception, and Error.

To filter your logs, follow these steps:

  1. Open Jahro's Console. You'll see a panel at the top with different colored toggles corresponding to each log type.
  2. To filter your logs, simply click the toggles for the log types you want to view. For instance, if you only want to see Warning logs, leave it active, and ensure the other toggles are inactive.
  3. As soon as you click a toggle, the console updates to display only the logs of the selected type(s).

You can activate multiple toggles at once. So if you want to see both Warning and Error logs, just make sure both of their toggles are active.

Searching Logs

When you need to find specific information within your logs, Jahro's search functionality is at your service.

  1. Open the Jahro Console, you'll find a search bar at the top of the panel.
  2. Simply type your search query into the bar. As you type, Jahro will start filtering the logs to match your query.
  3. Jahro highlights the matching part of each log, making it easier to spot the information you're looking for.

Log Management

Keeping your logs tidy can streamline your debugging process. Jahro offers several features for log management:

  • Clearing Logs: If your console gets too cluttered, or you just want a fresh start, you can clear all logs. Click the 'Clear All' button on Jahro's console to wipe the slate clean.

  • Selection Mode: You may want to focus on specific logs. Jahro's selection mode lets you do just that. Click on the 'Selection Mode' button to start selecting. Then, click on each log you want to select. Jahro will highlight your selected logs, making them easier to track.

  • Unfolding Log Messages: Some logs come with additional details hidden under the surface. Jahro allows you to unfold these logs to see more. Just click on the arrow next to the log to expand it. If there are any extra details or a stack trace, you'll be able to see it all.

Sharing Logs

Sharing functionality is designed to send logs via email. Here's how you can do it:

  • Copy and Share Individual Logs: Every log message in Jahro comes with a 'Copy' and 'Share' button. Hitting 'Copy' takes the log's details and puts it onto your clipboard, ready to be pasted wherever you need it. 'Share', on the other hand, prompts you to send the log details directly via email.

  • Copy and Share Selected Logs: If you're dealing with multiple logs, Jahro makes life easier. First, switch to 'Selection Mode' and choose the logs you want to share. Once you've made your selection, hit the 'Copy' or 'Share' button at the bottom of the console. All selected logs will be combined into the copied or shared information.
Whether you're collaborating with a team or documenting issues for future reference, Jahro's sharing features are designed to streamline the process.

Logs Indication

Jahro provides a simple and clear visual indication system for logs. Let's take a look at it:

  • Color Dots: There are four color-coded dots displayed at the top right of Jahro's UI. Each dot corresponds to a log level - Command, Debug, Warning, and Error.

  • Log Counters: Next to each dot is a counter, which shows the number of logs of each type. The counter is limited to 99 to keep the UI neat and clean.

  • New Log Animation: The dot corresponding to the log level will animate slightly whenever a new log of that type appears.

Command Results in Logs

Displaying command results in the Jahro console can be very handy, especially when you want to trace data flows and operational sequences in your game. It provides you with instant feedback and allows you to monitor the output of your commands in real time. Read more here.

To achieve this, simply define your command methods to return a string. This string will then be logged in the Jahro console once the command is executed. Here's an example:

[JahroCommand("root-objects")]
private static string GetRootGameObjects()
{
    string output = "Scene root objects:\n";
    var objects = SceneManager.GetActiveScene().GetRootGameObjects();
    foreach(var go in objects)
    {
        output += go.gameObject.name + " -- active: " + go.gameObject.activeInHierarchy + "\n";
    }
    return output;
}
In this example, the command root-objects returns a string listing all root game objects in the active scene. Once this command is executed, you'll see the list directly in the Jahro console.
Related articles
Getting Started with Jahro: Your First Steps to Efficient Unity Debugging
Embark on your journey with Jahro. Follow our simple step-by-step guide to install the plugin, create commands, and launch your project. Enhance your Unity 3D debugging experience with Jahro's powerful tools. Start now for a smoother, more efficient workflow.
Level Up Your Debugging Game in Unity with Jahro Commands
Discover how Jahro Commands can revolutionize your debugging process in Unity. Simplify game state management and create your own cheat codes.
Master Real-Time Debugging in Unity with Jahro Watcher Mode
Learn how Jahro's Watcher Mode can overhaul your Unity debugging process. Start tracking your game's variables in real-time