Beispiel #1
0
        /// <summary>
        /// The _X method is an override for the X function that allowes the specification of the name of the exit block
        /// wtihout allowing it to look up the name of the method to identify the block.  This should only be used in
        /// conjunction with the _E function.
        /// This method is only present when the DEBUG contiditional is specified
        /// </summary>
        /// <param name="theMessage">The message to write</param>
        internal void InternalX(MessageMetadata mmd, string theMessage)
        {
            // Have removed the stack based method - while this method is less efficient it does work cross threads
            // previously the lookup was done on enter and the data pushed into a stack.  This did not work for multiple
            // threads, each of which can be in a different method.
            string timeString = null;

            if (sets.AddTimingsToEnterExit)
            {
                DateTime dt = DateTime.Now;
                timeString = ">TRCTMR<|END|" + dt.Day + "|" + dt.Month + "|" + dt.Year + "|" + dt.Hour + "|" + dt.Minute + "|" + dt.Second + "|" + dt.Millisecond + "|";
            }

            mmd.CommandType    = TraceCommandTypes.TraceMessageOut;
            mmd.Body           = "< " + mmd.MethodName + " (" + theMessage + ")";
            mmd.FurtherDetails = timeString;

            ActiveRouteMessage(mmd);
            InternalTimeCheckpoint(mmd, Constants.AUTOTIMER_PREFIX + mmd.MethodName, Constants.INTERNAL_CLASS_REPLACE, false);
        }
Beispiel #2
0
        /// <summary>
        /// The _E function is a method of orverriding the E default behaviour of specifying the method name as the
        /// entry point to a block of code.  With _E you can specify a block name, however the corresponding _X function
        /// should be used to indicate the end of the block with the same string passed.
        /// This method is only present when the DEBUG contiditional is specified
        /// </summary>
        /// <param name="theMessage">The textual message to enter with</param>
        internal void InternalE(MessageMetadata mmd, string theMessage)
        {
            string timeString = null;

            if (sets.AddTimingsToEnterExit)
            {
                DateTime dt = DateTime.Now;
                timeString = ">TRCTMR<|SRT|" + dt.Day + "|" + dt.Month + "|" + dt.Year + "|" + dt.Hour + "|" + dt.Minute + "|" + dt.Second + "|" + dt.Millisecond + "|";
            }

            mmd.CommandType    = TraceCommandTypes.TraceMessageIn;
            mmd.Body           = "> " + mmd.MethodName + " (" + theMessage + ")";
            mmd.FurtherDetails = timeString;

            var tcmsg = mmd.Clone();

            InternalTimeCheckpoint(tcmsg, Constants.AUTOTIMER_PREFIX + Constants.INTERNAL_METHOD_REPLACE, Constants.INTERNAL_CLASS_REPLACE, true);

            ActiveRouteMessage(mmd);
        }
        protected virtual void ActiveRouteMessage(MessageMetadata mmd)
        {
#if DEBUG
            if (mmd == null)
            {
                throw new ArgumentNullException(nameof(mmd));
            }
            if (sets == null)
            {
                throw new InvalidOperationException("Settings must be set before this call. DevFault");
            }
            if (sets.metaContexts == null)
            {
                throw new InvalidOperationException("Settings.MetaContexts must be set before this call. DevFault");
            }
#endif

            // Some methods pass all this context around so the can call this directly.  All of the shared routing info should be done her
            // with the other overload only used to call this one.

            router.PrepareMetaData(mmd, sets.metaContexts);
            router.QueueMessage(mmd);
        }
Beispiel #4
0
        protected override string ActualConvert(MessageMetadata msg)
        {
            string       result;
            MessageParts nextMsg = new MessageParts();

            msg.NullsToEmptyStrings();
            // These will cause the stream to be written if we are queueingf messages.
            //if ((messageType == Constants.ASSERTIONFAILED) || (theMessage == Constants.EXCEPTIONENDTAG) || (messageType == Constants.ERRORMSG)) {
            //    nextMsg.TriggerRefresh = true;
            //}
            Emergency.Diags.Log("Formatting string");
            try {
                nextMsg.DebugMessage     = msg.Body;
                nextMsg.SecondaryMessage = msg.FurtherDetails;
                nextMsg.ClassName        = msg.ClassName;
                nextMsg.lineNumber       = msg.LineNumber;
                nextMsg.MethodName       = msg.MethodName;
                nextMsg.MachineName      = msg.MachineName;
                nextMsg.netThreadId      = msg.NetThreadId;
                nextMsg.osThreadId       = msg.OSThreadId;
                nextMsg.ProcessId        = msg.ProcessId;
                //nextMsg.ModuleName = Path.GetFileNameWithoutExtension(msg.FileName);
                nextMsg.ModuleName             = msg.FileName;
                nextMsg.AdditionalLocationData = msg.ClassName + "::" + msg.MethodName;

                // Populate Message Type
                nextMsg.MessageType = TraceCommands.TraceCommandToString(msg.CommandType);

                result = TraceMessageFormat.AssembleTexStringFromPartsStructure(nextMsg);
            } catch (Exception ex) {
                Emergency.Diags.Log("EXX >> " + ex.Message);
                throw;
            }
            Emergency.Diags.Log("REturning legacvy string" + result);
            return(result);
        }
Beispiel #5
0
 internal void PrepareMetaData(MessageMetadata mmd, Dictionary <string, string> contextKeys)
 {
     mmd.NetThreadId = Thread.CurrentThread.ManagedThreadId.ToString();
     mmd.OSThreadId  = Thread.CurrentThread.ManagedThreadId.ToString(); // TODO ! HArdcoded
     mmd.Context     = contextKeys[Bilge.BILGE_INSTANCE_CONTEXT_STR];
 }
Beispiel #6
0
 protected abstract void ActualAddMessage(MessageMetadata mmd);
Beispiel #7
0
 internal void QueueMessage(MessageMetadata mm)
 {
     ActualAddMessage(mm);
 }
 public string Convert(MessageMetadata msg)
 {
     return(ConvertWithReference(msg, DEFAULT_UQR));
 }
 protected abstract string ActualConvert(MessageMetadata msg);
 protected override string DefaultConvertWithReference(MessageMetadata msg, string uniquenessReference)
 {
     return(ConvertMsg(msg, uniquenessReference));
 }
 protected override string ActualConvert(MessageMetadata msg)
 {
     return(ConvertMsg(msg, DEFAULT_UQR));
 }
 protected override void ActualAddMessage(MessageMetadata mm)
 {
     ActualQueueMessage(mm);
 }