public MessageSourceProvider(int skipFrames)
        {
            CommonCentralLogic.FindMessageSource(skipFrames + 1, true, null,
                                                 out m_ClassName, out m_MethodName, out m_FileName, out m_LineNumber);

            OnMessageSourceCalculate(ref m_ClassName, ref m_MethodName, ref m_FileName, ref m_LineNumber);
        }
        /// <summary>
        /// Construct an ExceptionSourceProvider based on a provided Exception.
        /// </summary>
        /// <remarks>The first (closest) stack frame of the first (outer) Exception will be taken as the
        /// originator of a log message using this as its IMessageSourceProvider.</remarks>
        /// <param name="exception">The Exception whose first stack frame is the declared originator.</param>
        public ExceptionSourceProvider(Exception exception)
        {
            // We never skipped Gibraltar frames here, so go ahead with trustSkipFrames = true to disable that check.
            CommonCentralLogic.FindMessageSource(0, true, exception, out m_ClassName, out m_MethodName,
                                              out m_FileName, out m_LineNumber);

            OnMessageSourceCalculate(ref m_ClassName, ref m_MethodName, ref m_FileName, ref m_LineNumber);
        }
Exemplo n.º 3
0
        public MessageSourceProvider(int skipFrames, bool localOrigin)
        {
            const bool trustSkipFrames = true; // Set true to trust skipFrames count and don't skip over Gibraltar libs.

// ReSharper disable ConditionIsAlwaysTrueOrFalse
            CommonCentralLogic.FindMessageSource(skipFrames + 1, localOrigin || trustSkipFrames, null,
                                                 out m_ClassName, out m_MethodName, out m_FileName, out m_LineNumber);
// ReSharper restore ConditionIsAlwaysTrueOrFalse
        }