Endjin.Assembly.ChangeDetection.Infrastructure.Tracer.Execute C# (CSharp) Method

Execute() public static method

Executes the callback when the given trace level is enabled. That allows when tracing is enabled complex string formatting only when needed.
public static Execute ( MessageTypes msgType, Level level, TypeHashes type, System.Action action ) : bool
msgType MessageTypes The message type which must match.
level Level The trace level which must match.
type TypeHashes TypeHandle of your class.
action System.Action The delegate to execute when it does match.
return bool
        public static bool Execute(MessageTypes msgType, Level level, TypeHashes type, Action action)
        {
            if (TracerConfig.Instance.IsEnabled(type, msgType, level))
            {
                action();
                return true;
            }
            return false;
        }