code: def logToConsole(level=logging.INFO):
      """Create a log handler that logs to the console."""
      logger = logging.getLogger()
      stdHandlers = [
          h
          for h in logger.handlers
          if type(h) is logging.StreamHandler and h.stream is sys.stderr
      ]
      if stdHandlers:
          # if a standard stream handler already exists, use it and
          # set the log level for the ib_insync namespace only
          logging.getLogger("ib_insync").setLevel(level)
      else:
          # else create a new handler
          logger.setLevel(level)
          formatter = logging.Formatter(
              "%(asctime)s %(name)s %(levelname)s %(message)s"
          )
          handler = logging.StreamHandler()
          handler.setFormatter(formatter)
          logger.addHandler(handler)
  
imports: import asyncio
  import datetime
  import logging
  import math
  import signal
  import sys
  import time
  from dataclasses import fields, is_dataclass
  from typing import AsyncIterator, Awaitable, Callable, Iterator, List, Optional, Union
  import eventkit
label_desc: Use image node_id 12 for calling a global function with example usage: logToConsole(level) without return types