In Unity, the console is the most important place where we debug and output variables or objects. Here is an example of the console output in Unity:

Is there anyway we can customize the output like the following?

The answer is yes. Create a script and attached it as a component in your GameManager or Main Camera.

Create a script and put it under your project. You don't have to attach it to any game object.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public static class DebugUtil {

    public static string AddBoldTag(this string text) {
        return text.AddTag("b");
    }

    public static string AddItalicTag(this string text) {
        return text.AddTag("i");
    }

    public static string AddSizeTag(this string text, int size) {
        return text.AddTag("size", size);
    }

    public static string AddColorTag(this string text, string colorName) {
        return text.AddTag("color", colorName);
    }

    private static string AddTag(this string text, string tagName) {
        return $"<{tagName}>{text}</{tagName}>";
    }

    private static string AddTag(this string text, string tagName, object value1) {
        return $"<{tagName}=\"{value1}\">{text}</{tagName}>";
    }
}

To use:

var logBulletTime = "running bullet: " + bulletLifeTime.ToString();
Debug.Log(logBulletTime.AddBoldTag().AddColorTag("red"));