<human>:  What is a good Python code to write a variable value to log.
<bot>: Here is a Python code to write a variable value to log

import sys

def write_to_log(log_file, variable_name, value):
  """
  Write a variable value to log
  """
  with open(log_file, 'a') as f:
    f.write("{}: {}\n".format(variable_name, value))

# Enter the log file
log_file = "log.txt"

# Enter the variable name
variable_name = "test"

# Enter the value
value = "test"

# Calling the function
print((write_to_log(log_file, variable_name, value)))

#Example Output
# None

#Remember to inspect code for bugs.