Duality.Log.CurrentMethod C# (CSharp) Method

CurrentMethod() public static method

Returns the name of the caller method.
public static CurrentMethod ( int skipFrames, bool includeDeclaringType = true ) : string
skipFrames int The number of frames to skip. This function itsself is omitted by default.
includeDeclaringType bool If true, the methods declaring type is included in the returned name.
return string
        public static string CurrentMethod(int skipFrames = 0, bool includeDeclaringType = true)
        {
            return MethodInfo(CurrentStackFrame(skipFrames + 1).GetMethod(), includeDeclaringType);
        }

Usage Example

Example #1
0
        /// <summary>
        /// Checks for errors that might have occurred during audio processing.
        /// </summary>
        /// <param name="silent">If true, errors aren't logged.</param>
        /// <returns>True, if an error occurred, false if not.</returns>
        public static bool CheckOpenALErrors(bool silent = false)
        {
            if (sound != null && !sound.IsAvailable)
            {
                return(false);
            }
            ALError error;
            bool    found = false;

            while ((error = AL.GetError()) != ALError.NoError)
            {
                if (!silent)
                {
                    Log.Core.WriteError(
                        "Internal OpenAL error, code {0} at {1}",
                        error,
                        Log.CurrentMethod(1));
                }
                found = true;
            }
            if (found && !silent && System.Diagnostics.Debugger.IsAttached)
            {
                System.Diagnostics.Debugger.Break();
            }
            return(found);
        }
All Usage Examples Of Duality.Log::CurrentMethod