CuriousBenjamin
CuriousBenjamin

Reputation: 719

NLog:: adding source code line number to the log

I need source code line number to the log entry through NLog.

Please let me know alternate ways to do it.

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

P.S. - 23, 391 are the source code line numbers. Thanks

Upvotes: 5

Views: 8472

Answers (2)

crazyoxygen
crazyoxygen

Reputation: 716

Not sure but you should try this. Hope it will help :D

http://iosdevelopertips.com/cocoa/filename-and-line-number-with-nslog-part-ii.html

and I also found this

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

from this How can I log the current line via NSLog in Cocoa / Objective C?

EDIT sry I dont know that u want C# should try look at this

Do __LINE__ __FILE__ equivalents exist in C#?

Upvotes: -2

kolbasov
kolbasov

Reputation: 1588

You may use ${callsite:fileName=true} layout renderer - indicates whether to render the source file name and line number. Documentation.

Upvotes: 11

Related Questions