code: def time_log(logger: logging.Logger = get_logger("main_logger")):
      """
      A decorator function that logs the runtime of the function it is decorating
      to the logger object that is taken as an argument.
      Inspired by:
      `https://medium.com/pythonhive/python-decorator-to-measure-the-execution-time-of-methods-fa04cb6bb36d`_.
  
      Parameters
      ----------
      logger
          The logger instance to log the runtime of the function.
      """
  
      def time_log_helper(method):
          def timed(*args, **kwargs):
              start_time = time.time()
              result = method(*args, **kwargs)
              end_time = time.time()
              duration = int((end_time - start_time) * 1000)
              logger.info(
                  method.__name__
                  + f" function ran for {duration} milliseconds"
              )
              return result
  
          return timed
  
      return time_log_helper
  
file_path: darts/darts/logging.py
imports: import logging
  import os
  import time
  import warnings
label_desc: Use image node_id 6 for calling a global function with example usage: time_log(logger) and returns: time_log_helper, timed, result