using UnityEngine;
using DiscordRPC.Logging;
namespace Lachee.Discord.Control
{
///
/// This is a bridge between the Discord IPC logging and Unity Logging. Useful for debugging errors within the pipe.
///
public sealed class UnityLogger : DiscordRPC.Logging.ILogger
{
public LogLevel Level { get; set; }
public void Trace(string message, params object[] args)
{
if (Level > LogLevel.Trace) return;
Debug.Log(" " + (args.Length > 0 ? string.Format(message, args) : message));
}
public void Info(string message, params object[] args)
{
if (Level > LogLevel.Info) return;
Debug.Log(" " + (args.Length > 0 ? string.Format(message, args) : message));
}
public void Warning(string message, params object[] args)
{
if (Level > LogLevel.Warning) return;
Debug.LogWarning(" " + (args.Length > 0 ? string.Format(message, args) : message));
}
public void Error(string message, params object[] args)
{
if (Level > LogLevel.Error) return;
Debug.LogError(" " + (args.Length > 0 ? string.Format(message, args) : message));
}
}
}