using UnityEngine;
using System.Diagnostics;

/// <summary>
/// DevLog — Drop-in Debug.Log replacement.
/// All Log/LogWarning calls are compiled out in non-editor, non-development release builds
/// via [Conditional] attributes, eliminating ALL string allocation from logging.
///
/// Usage: Replace Debug.Log("msg") with DevLog.Log("msg")
///        Replace Debug.LogWarning("msg") with DevLog.LogWarning("msg")
///
/// Debug.LogError is NOT wrapped — errors should always log for crash reporting.
///
/// OPTIMIZATION IMPACT:
///   Before: 300+ Debug.Log calls creating string garbage every invocation
///   After:  Zero string allocation in release builds (calls compiled out entirely)
///
/// RISK: Low — purely additive utility class. No existing code is changed by its existence.
/// ROLLBACK: Delete this file. Revert DevLog.Log → Debug.Log in any changed files.
/// </summary>
public static class DevLog
{
    [Conditional("UNITY_EDITOR"), Conditional("DEVELOPMENT_BUILD")]
    public static void Log(string message)
    {
        UnityEngine.Debug.Log(message);
    }

    [Conditional("UNITY_EDITOR"), Conditional("DEVELOPMENT_BUILD")]
    public static void Log(string message, Object context)
    {
        UnityEngine.Debug.Log(message, context);
    }

    [Conditional("UNITY_EDITOR"), Conditional("DEVELOPMENT_BUILD")]
    public static void LogWarning(string message)
    {
        UnityEngine.Debug.LogWarning(message);
    }

    [Conditional("UNITY_EDITOR"), Conditional("DEVELOPMENT_BUILD")]
    public static void LogWarning(string message, Object context)
    {
        UnityEngine.Debug.LogWarning(message, context);
    }

    // LogError is intentionally NOT conditional — errors must always reach crash reporting
    public static void LogError(string message)
    {
        UnityEngine.Debug.LogError(message);
    }

    public static void LogError(string message, Object context)
    {
        UnityEngine.Debug.LogError(message, context);
    }
}
