Ian Branch 127 Posted June 20, 2023 Hi Team, D11.3. Is there a way to pickup the number at build/compile time so I can include it in a log message? e.g. something like..LogMessage('This is line # '+%LineNumber%); I know I can hard code it but it would need to be re-done every time there is a code change. Regards & TIA, Ian Share this post Link to post
programmerdelphi2k 237 Posted June 21, 2023 @Ian Branch you can try assign "AssertErrorProc" used by system to get some info on exception... here some samples https://stackoverflow.com/questions/7214213/how-to-get-line-number-at-runtime 1 Share this post Link to post
programmerdelphi2k 237 Posted June 21, 2023 @Ian Branch no thanks, no likes 😂 Share this post Link to post
programmerdelphi2k 237 Posted June 21, 2023 @Ian Branch I see it... but a magic-button massages the ego Share this post Link to post
Fr0sT.Brutal 900 Posted June 21, 2023 https://github.com/Fr0sT-Brutal/Delphi_StackTraces/blob/master/Ice.Debug.pas Requires MAP file (but there's option to include it into EXE) Share this post Link to post
Remy Lebeau 1396 Posted June 21, 2023 21 hours ago, Ian Branch said: Is there a way to pickup the number at build/compile time so I can include it in a log message? e.g. something like..LogMessage('This is line # '+%LineNumber%); In C++, yes (via __LINE__), and even in FreePascal, yes (via {$INCLUDE %LINE%}), but not in Delphi, no. Share this post Link to post