Пример #1
0
        public string GetCallerClassName(MethodBase method, bool includeNameSpace, bool cleanAsyncMoveNext, bool cleanAnonymousDelegates)
        {
            if (!string.IsNullOrEmpty(CallerClassName))
            {
                if (includeNameSpace)
                {
                    return(CallerClassName);
                }
                else
                {
                    int lastDot = CallerClassName.LastIndexOf('.');
                    if (lastDot < 0 || lastDot >= CallerClassName.Length - 1)
                    {
                        return(CallerClassName);
                    }
                    else
                    {
                        return(CallerClassName.Substring(lastDot + 1));
                    }
                }
            }

            method = method ?? GetCallerStackFrameMethod(0);
            if (method == null)
            {
                return(string.Empty);
            }

            cleanAsyncMoveNext      = cleanAsyncMoveNext || UserStackFrameNumberLegacy.HasValue;
            cleanAnonymousDelegates = cleanAnonymousDelegates || UserStackFrameNumberLegacy.HasValue;
            return(StackTraceUsageUtils.GetStackFrameMethodClassName(method, includeNameSpace, cleanAsyncMoveNext, cleanAnonymousDelegates) ?? string.Empty);
        }
Пример #2
0
        public string GetCallerClassName(MethodBase method, bool includeNameSpace, bool cleanAsyncMoveNext, bool cleanAnonymousDelegates)
        {
            method = method ?? GetCallerStackFrameMethod(0);
            if (method == null)
            {
                return(string.Empty);
            }

            cleanAsyncMoveNext      = cleanAsyncMoveNext || UserStackFrameNumberLegacy.HasValue;
            cleanAnonymousDelegates = cleanAnonymousDelegates || UserStackFrameNumberLegacy.HasValue;
            return(StackTraceUsageUtils.GetStackFrameMethodClassName(method, includeNameSpace, cleanAsyncMoveNext, cleanAnonymousDelegates) ?? string.Empty);
        }
Пример #3
0
        public string GetCallerMemberName(MethodBase method, bool includeMethodInfo, bool cleanAsyncMoveNext, bool cleanAnonymousDelegates)
        {
            if (!string.IsNullOrEmpty(CallerMemberName))
            {
                return(CallerMemberName);
            }

            method = method ?? GetCallerStackFrameMethod(0);
            if (method == null)
            {
                return(string.Empty);
            }

            cleanAsyncMoveNext      = cleanAsyncMoveNext || UserStackFrameNumberLegacy.HasValue;
            cleanAnonymousDelegates = cleanAnonymousDelegates || UserStackFrameNumberLegacy.HasValue;
            return(StackTraceUsageUtils.GetStackFrameMethodName(method, includeMethodInfo, cleanAsyncMoveNext, cleanAnonymousDelegates) ?? string.Empty);
        }
Пример #4
0
        /// <summary>
        /// Assembly to skip?
        /// </summary>
        /// <param name="frame">Find assembly via this frame. </param>
        /// <returns><c>true</c>, we should skip.</returns>
        private static bool SkipAssembly(StackFrame frame)
        {
            var assembly = StackTraceUsageUtils.LookupAssemblyFromStackFrame(frame);

            return(assembly == null || LogManager.IsHiddenAssembly(assembly));
        }