Execute Logs

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!