code: def init_logging(level=logging.INFO, dir="", verbose=False):
      """
      Init logging.
  
      Parameters:
          level (int, optional): logging level, INFO, WARNING, ERROR or FATAL
          dir (str, optional): log directory, leave empty for standard I/O
          verbose (bool, optional): verbose mode
      """
      logger = logging.getLogger(__package__)
      logger.level = level
      if dir == "":
          logger.handlers = [logging.StreamHandler(sys.stdout)]
      else:
          logger.handlers = [
              logging.FileHandler(os.path.join(dir, "log.txt"))
          ]
  
      if level <= logging.INFO:
          lib.init_logging(lib.INFO, dir, verbose)
      elif level <= logging.WARNING:
          lib.init_logging(lib.WARNING, dir, verbose)
      elif level <= logging.ERROR:
          lib.init_logging(lib.ERROR, dir, verbose)
      else:
          lib.init_logging(lib.FATAL, dir, verbose)
  
file_path: graphvite/python/graphvite/base.py
imports: from __future__ import absolute_import
  import os
  import sys
  import yaml
  import logging
  from easydict import EasyDict
  from .None import lib, dtype
  from .util import recursive_default, assert_in
label_desc: Use image node_id 2 for calling a global function with example usage: init_logging(level, dir, verbose) without return types