Android Question How to print out the method name and line number?

Rabbit

Member
Licensed User
Longtime User
Hi,

When I debug my app in the end user device I need to log functions activities in FILE.LOG for debugging

How to print out the method name and line number?

In this case I need to insert customized function such as :

APPEND("FILE.LOG", "GetSqlRow")

is there built in function gives me the reflected current line code in the B4A?
i.e:

APPEND("FILE.LOG", "GetSqlRow", GetCurrentLineCode)

example:

B4X:
NSLog(@"%s %d %s %s", __FILE__, __LINE__, __PRETTY_FUNCTION__, __FUNCTION__);
Outputs file name, line number, and function name:
/proj/cocoa/cdcli/cdcli.m 121 managedObjectContext managedObjectContext
__FUNCTION__ in C++ shows mangled name __PRETTY_FUNCTION__ shows nice function name, in cocoa they look the same.


Thank you.
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…