コード例 #1
0
        public OutputWindowTraceListener(TraceStreamOptions options)
        {
            this.options = options;
            var outputWindow = Package.GetGlobalService(typeof(SVsOutputWindow)) as IVsOutputWindow;

            Guid debugPaneGuid = VSConstants.OutputWindowPaneGuid.DebugPane_guid;
            var result = outputWindow.GetPane(ref debugPaneGuid, out debugPane);
            if (result != VSConstants.S_OK)
            {
                throw new Exception("Unable to get an instance of the debug window pane");
            }
        }
コード例 #2
0
ファイル: TraceManager.cs プロジェクト: soundarmoorthy/Ichnos
        private XElement ComposeXmlMessage(TraceMessageSourceEntry message, TraceStreamOptions options)
        {
            XElement element = new XElement(XName.Get(Names.TraceEntry));

            var symbolExpression = message.Expression;

            if (symbolExpression.IsValidValue)
            {
                var symbolElement = new XElement(XName.Get(Names.LocalVariableEntry));
                symbolElement.SetAttributeValue(XName.Get(Names.LocalVariableEntryAttributeName), symbolExpression.Name);
                symbolElement.SetAttributeValue(XName.Get(Names.LocalVariableEntryAttributeValue), symbolExpression.Value);
                element.Add(symbolElement);
            }

            if (options.IncludeDateTime)
            {
                element.Add(new XElement(XName.Get(Names.TimeStamp)), DateTime.Now.ToString());
            }

            if (options.IncludeColumnNumber)
            {
                var colNumber = new XElement(XName.Get(Names.FileColumn), message.Breakpoint.FileColumn);
                element.Add(colNumber);
            }
            if (options.IncludeFileName)
            {
                var fileName = new XElement(XName.Get(Names.FileName), message.Breakpoint.File);
                element.Add(fileName);
            }
            if (options.IncludeFunctionName)
            {
                var functionName = new XElement(XName.Get(Names.FunctionName), message.Breakpoint.FunctionName);
                element.Add(functionName);
            }
            if (options.IncludeLineNumber)
            {
                var lineNumber = new XElement(XName.Get(Names.FileLine), message.Breakpoint.FileLine);
                element.Add(lineNumber);
            }
            if (options.IncludeLocalVariables)
            {
                var localElement = new XElement(XName.Get(Names.Locals));
                element.Add(localElement);
                foreach (Expression variable in message.StackFrame.Locals)
                {
                    var localVariable = new XElement(XName.Get(Names.LocalVariableEntry));
                    localVariable.SetAttributeValue(XName.Get(Names.LocalVariableEntryAttributeName), variable.Name);
                    localVariable.SetAttributeValue(XName.Get(Names.LocalVariableEntryAttributeValue), variable.Value);
                    localElement.Add(localVariable);
                }
            }
            return(element);
        }
コード例 #3
0
        public FileStreamTraceListener(string fileName, TraceStreamOptions options)
        {
            if (string.IsNullOrEmpty(fileName))
                throw new ArgumentException("Invalid file name", "fileName");
            if (Path.GetInvalidFileNameChars().Any() || Path.GetInvalidPathChars().Any())
                throw new ArgumentException("Invalid characters found in path", "fileName");
            if (!Directory.Exists(Path.GetDirectoryName(fileName)))
                throw new DirectoryNotFoundException(string.Format("Unable to create a file stream for the file {0}", fileName));

            writer = new StreamWriter(fileName);
            this.options = options;
        }
コード例 #4
0
        public OutputWindowTraceListener(TraceStreamOptions options)
        {
            this.options = options;
            var outputWindow = Package.GetGlobalService(typeof(SVsOutputWindow)) as IVsOutputWindow;

            Guid debugPaneGuid = VSConstants.OutputWindowPaneGuid.DebugPane_guid;
            var  result        = outputWindow.GetPane(ref debugPaneGuid, out debugPane);

            if (result != VSConstants.S_OK)
            {
                throw new Exception("Unable to get an instance of the debug window pane");
            }
        }
コード例 #5
0
        public FileStreamTraceListener(string fileName, TraceStreamOptions options)
        {
            if (string.IsNullOrEmpty(fileName))
            {
                throw new ArgumentException("Invalid file name", "fileName");
            }
            if (Path.GetInvalidFileNameChars().Any() || Path.GetInvalidPathChars().Any())
            {
                throw new ArgumentException("Invalid characters found in path", "fileName");
            }
            if (!Directory.Exists(Path.GetDirectoryName(fileName)))
            {
                throw new DirectoryNotFoundException(string.Format("Unable to create a file stream for the file {0}", fileName));
            }

            writer       = new StreamWriter(fileName);
            this.options = options;
        }
コード例 #6
0
ファイル: TraceManager.cs プロジェクト: soundarmoorthy/Ichnos
        private XElement ComposeXmlMessage(TraceMessageSourceEntry message, TraceStreamOptions options)
        {
            XElement element = new XElement(XName.Get(Names.TraceEntry));

            var symbolExpression = message.Expression;

            if (symbolExpression.IsValidValue)
            {
                var symbolElement = new XElement(XName.Get(Names.LocalVariableEntry));
                symbolElement.SetAttributeValue(XName.Get(Names.LocalVariableEntryAttributeName), symbolExpression.Name);
                symbolElement.SetAttributeValue(XName.Get(Names.LocalVariableEntryAttributeValue), symbolExpression.Value);
                element.Add(symbolElement);
            }

            if (options.IncludeDateTime)
            {
                element.Add(new XElement(XName.Get(Names.TimeStamp)), DateTime.Now.ToString());
            }

            if (options.IncludeColumnNumber)
            {
                var colNumber = new XElement(XName.Get(Names.FileColumn), message.Breakpoint.FileColumn);
                element.Add(colNumber);
            }
            if (options.IncludeFileName)
            {
                var fileName = new XElement(XName.Get(Names.FileName), message.Breakpoint.File);
                element.Add(fileName);
            }
            if (options.IncludeFunctionName)
            {
                var functionName = new XElement(XName.Get(Names.FunctionName), message.Breakpoint.FunctionName);
                element.Add(functionName);
            }
            if (options.IncludeLineNumber)
            {
                var lineNumber = new XElement(XName.Get(Names.FileLine), message.Breakpoint.FileLine);
                element.Add(lineNumber);
            }
            if (options.IncludeLocalVariables)
            {
                var localElement = new XElement(XName.Get(Names.Locals));
                element.Add(localElement);
                foreach (Expression variable in message.StackFrame.Locals)
                {
                    var localVariable = new XElement(XName.Get(Names.LocalVariableEntry));
                    localVariable.SetAttributeValue(XName.Get(Names.LocalVariableEntryAttributeName), variable.Name);
                    localVariable.SetAttributeValue(XName.Get(Names.LocalVariableEntryAttributeValue), variable.Value);
                    localElement.Add(localVariable);
                }
            }
            return element;
        }