Static editor logger wrapper for ShaderGraphPlus that forwards Info, Trace, Warning, and Error calls to an underlying Logger instance named with ShaderGraphPlusGlobals.CleanName. Provides an overload to log exceptions with a message.
namespace ShaderGraphPlus.Diagnostics;
public static class SGPLogger
{
private static Logger _log => new( ShaderGraphPlusGlobals.CleanName );
/// <summary>
/// Name of this logger.
/// </summary>
public static string Name => ShaderGraphPlusGlobals.CleanName;
public static void Info( string message, bool shouldLog = true )
{
if ( shouldLog )
_log.Info( message );
}
public static void Trace( string message, bool shouldLog = true )
{
if ( shouldLog )
_log.Trace( message );
}
public static void Warning( string message, bool shouldLog = true )
{
if ( shouldLog )
_log.Warning( message );
}
public static void Error( string message, bool shouldLog = true )
{
if ( shouldLog )
_log.Error( message );
}
public static void Error( Exception exception, string message, bool shouldLog = true )
{
if ( shouldLog )
_log.Error( exception, message );
}
}