Jump to content

Can I grab the details of a calling function (file name, function name, etc.)


HGeneAnthony

Recommended Posts

I'm creating a logging class and I'd like to record the function name where an error was logged, as well as line number, file name, etc.  I know I can pass the details __LINE__, __FILE__, __FUNCTION__, __CLASS__, as arguments to a function but this is a pain in the ass to do this for every error and it makes the code look sloppy.  I would like to just put these details in the error function so I can keep it clean, however this will put in the current function details not the calling function so I was wondering is there a way to do this?

I meant arguments.  I don't want to have to pass the __LINE__, __FILE__, __CLASS__, etc. each time I call a log or error.  I would just like to use a log function and have it grab the data of the function that called it.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.