line-numbers

Output line number in Rails log file

会有一股神秘感。 提交于 2019-12-04 07:48:24
From the Rails Guide on debugging, I found that I can customize output to my log files using this simple method: logger.debug "Person attributes hash: #{@person.attributes.inspect}" I decided use this to track how a variable changes and goes through flow control. I would like to be able to see the line number of my code where logger#debug method was called. Something like this: logger.debug "Person attributes hash: #{@person.attributes.inspect} from line #{LINE_NUMBER_VAR}" DNNX logger.debug "Person attributes hash: #{@person.attributes.inspect} from line #{__LINE__}" Use a decorator on Logger

PHP get line number from logging event

自古美人都是妖i 提交于 2019-12-04 06:19:13
Ok I have another question HERE for my Logging Class but I wanted to be able to add the line number of the calling script to the log file entry. I have seen __Line __ but this gives me the line number of the line where this is at. Example: a.php $log = new Logger(); $log->debug('hello'); // Say this is line #20 Now in my Logger.php class in the debug() I use the __Line __ Magic Constant on for example line #300. When I run the script I would like the log entry to read 'on line 20' but it read 'on line 300'. Besides passing the line number to the function is there any other way I could do this?

How to activate revision info in line number view

五迷三道 提交于 2019-12-04 03:55:07
I know of an Eclipse feature to show revision information (gradual coloring, more info like revisionnumber, date and author on mouseover) for the last changes in a line in the linenumbers-view. Does anyone know how to activate this feature for a file, or even better, by default? I accidently hit some shortcut lately which made it show in one file, it does not show up in the others, though. This is called "Show Annotation" and you can find it in the "Team" menu. Since this is a pretty expensive operation, you can't make it the default. msa Regarding the shortcut: You have to enable the command

Get line numbers of fields without using a c# parser

半世苍凉 提交于 2019-12-03 16:36:59
I would like to get the line #s of a type's fields. To get the line #'s of the statements in a method it is simple enough: Type type = typeof(MyClass); MethodInfo methodInfo = type.GetMethod("SomeMethod"); int token = methodInfo.MetadataToken; ISymbolReader reader = SymUtil.GetSymbolReaderForFile(@"dllName", null); // from mike stall's pdb2xml ISymbolMethod methodSymbol = reader.GetMethod(new SymbolToken(token)); int count = methodSymbol.SequencePointCount; ISymbolDocument[] docs = new ISymbolDocument[count]; int[] startColumn = new int[count]; int[] endColumn = new int[count]; int[] startRow

Text editor with syntax highlighting and line numbers?

那年仲夏 提交于 2019-12-03 13:36:12
问题 This is a bit challenging even probably for a team project, let alone for a one-man implementation, but I was trying to put together a simple yet elegant text editor with syntax highlighting, using a JEditorPane . I stumbled upon this which was discontinued and really hard for me to understand with all the lexer files and .lex stuff inside. I even found in some blog that this project was later taken on by some other team but even yet again discontinued. I don't need it to be too fancy, like

Preserving original StackTrace/LineNumbers in .NET Exceptions

╄→尐↘猪︶ㄣ 提交于 2019-12-03 11:34:59
Understanding the difference between throw ex and throw , why is the original StackTrace preserved in this example: static void Main(string[] args) { try { LongFaultyMethod(); } catch (System.Exception ex) { Console.WriteLine(ex.StackTrace); } } static void LongFaultyMethod() { try { int x = 20; SomethingThatThrowsException(x); } catch (Exception) { throw; } } static void SomethingThatThrowsException(int x) { int y = x / (x - x); } But not in this one: static void Main(string[] args) { try { LongFaultyMethod(); } catch (System.Exception ex) { Console.WriteLine(ex.StackTrace); } } static void

Python debugging: get filename and line number from which a function is called?

橙三吉。 提交于 2019-12-03 06:38:46
问题 I'm currently building quite a complex system in Python, and when I'm debugging I often put simple print statements in several scripts. To keep an overview I often also want to print out the file name and line number where the print statement is located. I can of course do that manually, or with something like this: from inspect import currentframe, getframeinfo print getframeinfo(currentframe()).filename + ':' + str(getframeinfo(currentframe()).lineno) + ' - ', 'what I actually want to print

Text editor with syntax highlighting and line numbers?

半腔热情 提交于 2019-12-03 03:34:38
This is a bit challenging even probably for a team project, let alone for a one-man implementation, but I was trying to put together a simple yet elegant text editor with syntax highlighting, using a JEditorPane . I stumbled upon this which was discontinued and really hard for me to understand with all the lexer files and .lex stuff inside. I even found in some blog that this project was later taken on by some other team but even yet again discontinued. I don't need it to be too fancy, like having code folding and stuff (even though I am tempted to find out how to do this), but I need at least

MATLAB Debugger no longer showing line numbers

隐身守侯 提交于 2019-12-02 07:40:14
问题 I'm not entirely sure how, but my copy of MATLAB R2013b has stopped showing which line my errors occur at. I'll just get errors like: Subscripted assignment dimension mismatch. But no line number to go along with it, so I have no idea which part of my code is causing the problem! Did I mess up a setting somewhere? 回答1: Enable line numbering in the editor with Preferences -> Editor/Debugger -> Display -> Show line numbers When running code segments (for example, using Ctrl+Enter with the

java - get text from JTextArea by number line

强颜欢笑 提交于 2019-12-02 04:41:27
问题 For my case, I want to get text inside JTextArea by number line. For e.g name : andy birth : jakarta, 1 jan 1990 number id : 01011990 01 age : 26 study : Informatics engineering So, I want to get a text in line 3. I think I can use jTextArea.getText(3,jTextArea.getText().length()) , but it doesn't work. so, from line 3, i wish get text number id : 01011990 01 回答1: Simply based on the example from your previous question... Document doc = textArea.getDocument(); Element root = doc