View Article

Tracing Helper methods

By Xelence Documentation posted 05-02-2025 09:07

  


using Sagitec.Rules.Core.Instance.Attributes;

using Sagitec.Rules.Core.Interface;

using System.Runtime.CompilerServices;

namespace Sagitec.Rules.Interface.Helper.Execution

{

    /// <summary>

    /// Provides methods for execution tracing, including logging and rule tracing.

    /// Implements <see cref="ICoreInstance"/> and <see cref="IExecutionContextHelper"/> to support core instance management and execution context initialization.

    /// </summary>


    [SingletonInstance]

    public interface IExecutionTracingHelper : ICoreInstance, IExecutionContextHelper

    {

        #region Public Methods

        /// <summary>

        /// Enables or disables tracing for a rule execution.

        /// </summary>

        /// <param name="ablnTrace">A boolean value indicating whether tracing is enabled. The default is <c>true</c>.</param>

        /// <returns><c>true</c> if tracing is enabled; otherwise, <c>false</c>.</returns>

        /// <remarks>

        /// This method is used to determine whether tracing should be performed during rule execution.

        /// </remarks>

        bool TraceRule(bool ablnTrace);


        /// <summary>

        /// Writes an error message to the log.

        /// </summary>

        /// <param name="astrMessage">The error message to log.</param>

        /// <param name="astrCallerMemberName">

        /// The name of the calling member. This parameter is automatically populated by the compiler.

        /// </param>

        /// <remarks>

        /// This method logs error messages to the appropriate logging mechanism, including the name of the calling member.

        /// </remarks>

        void WriteErrorLog(string astrMessage, [CallerMemberName] string astrCallerMemberName);


        /// <summary>

        /// Writes an informational message to the log.

        /// </summary>

        /// <param name="astrMessage">The informational message to log.</param>

        /// <param name="astrCallerMemberName">

        /// The name of the calling member. This parameter is automatically populated by the compiler.

        /// </param>

        /// <remarks>

        /// This method logs informational messages to the appropriate logging mechanism, including the name of the calling member.

        /// </remarks>

        void WriteInformationLog(string astrMessage, [CallerMemberName] string astrCallerMemberName);


        /// <summary>

        /// Writes a warning message to the log.

        /// </summary>

        /// <param name="astrMessage">The warning message to log.</param>

        /// <param name="astrCallerMemberName">

        /// The name of the calling member. This parameter is automatically populated by the compiler.

        /// </param>

        /// <remarks>

        /// This method logs warning messages to the appropriate logging mechanism, including the name of the calling member.

        /// </remarks>

        void WriteWarningLog(string astrMessage, [CallerMemberName] string astrCallerMemberName);

        #endregion Public Methods

    }

}


#Rules

0 comments
25 views