To clarify, I am trying to log function calls in a database in the following manner
# Method to write to database a log of every function call along with the parameters
def write_program_log(function_name, function_parameters_json_format):
And here is what I am pasting inside of my functions
def connection_sniffer():
# Program Logging Call
if gvl.global_program_logging_state:
# First convert params into JSON object
pythonValues = dict(locals())
jsonValues = json.dumps(pythonValues)
write_program_log(__name__, jsonValues)
i was expecting __name__
to refer to the name of the local scope function, but instead the variable is equal to __main__
Is there something else I can use to easily get the name of the local scope function without having to manually type out the name? Thanks!