code: def set_formatter(logger):
      """
      The Lambda execution environment injects a default `LambdaLoggerHandler`
      into the root logger, so we just want to update the traceback formatter on
      it without changing the actual logging format.
  
      Alternatively, locally the root logger will not have any handlers. In this case,
      we create a logging.StreamHandler and add the formatter to it.
  
      Args:
          logger (logging.Logger): An instance of a logger for which to update the formatter
      """
      # Update the LambdaLoggerHandler formatter if there is one
      if not logger.hasHandlers():
          return
  
      for handler in logger.handlers + logger.parent.handlers:
          # pylint: disable=protected-access
          # Retain the handlers format spec if it has one
          fmt = handler.formatter._fmt if handler.formatter else None
          handler.setFormatter(LogFormatter(fmt=fmt))
  
imports: import logging
  import os
label_desc: Use image node_id 1 for calling a global function with example usage: set_formatter(logger) without return types