コード例 #1
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);
        }
コード例 #2
0
        private string ConvertMsg(MessageMetadata msg, string defaultUqr)
        {
            msg.NullsToEmptyStrings();

            string result;

            try {
                string ald       = msg.ClassName + "::" + msg.MethodName;
                string metaPart  = $"\"v\":\"2\",\"uq\":\"{defaultUqr}\"";
                string cnamePart = $"\"c\":\"{EscapeString(msg.ClassName)}\",\"l\":\"{msg.LineNumber}\",\"mn\":\"{EscapeString(msg.MethodName)}\",\"md\":\"{EscapeString(msg.FileName)}\",\"al\":\"{EscapeString(ald)}\"";
                string procPart  = $"\"nt\":\"{msg.NetThreadId}\",\"p\":\"{msg.ProcessId}\",\"t\":\"{msg.OSThreadId}\",\"man\":\"{EscapeString(msg.MachineName)}\"";
                string msgPart   = $"\"m\":\"{EscapeString(msg.Body)}\",\"s\":\"{EscapeString(msg.FurtherDetails)}\",\"mt\":\"{TraceCommands.TraceCommandToString(msg.CommandType)}\"";
                result = $"{{ {metaPart},{cnamePart},{procPart},{msgPart} }}";
            } catch (Exception ex) {
                Emergency.Diags.Log("EXX >> " + ex.Message);
                throw;
            }
            return(result);
        }