Get current definition name

I’m looking to generate a definition log file.

Each time a definition is run (from a template) the current definition, current user, and current time are logged to a centrally located text file.

The last two parts were simple but I’m not sure where to start or if its even possible to snag the definition name automatically.

As a last resort I can force it as an input for every definition but that’s at the risk of users maintaining it.

Anyone know how to approach this via python?

Thanks in advance.