NLog :: add source line number to log

I need the line number of the source code to write the log via NLog.

Please let me know alternative ways to do this.

<<Log entry>> Line 23 
 <<Log entry>> Line 391


PS - 23, 391 - source code line numbers. Thanks to


source to share

2 answers

You can use layout rendering $ {callsite: fileName = true} - specifies whether to display the source file name and line number. Documentation .



Not sure, but you should try this. Hope this helps: D

and i also found this

NSLog(@"current line: %d",__LINE__);


from this How can I register the current row via NSLog in Cocoa / Objective C?

EDIT sry I don't know what you want C # should try to look at this

Do __LINE__ __FILE__ equivalents exist in C #?



All Articles