code: def __init__(
      self, dirname, config=None, overwrite=False, logging=True
  ):
      self.logging = logging
      if os.path.exists(dirname):
          if not overwrite:
              raise Exception(
                  "Directory already exists: {}".format(dirname)
              )
      else:
          os.makedirs(dirname)
  
      if config is not None:
          self.log_json(
              config, os.path.join(dirname, Constants._CONFIG_FILE)
          )
  
      if logging:
          self.fout = open(
              os.path.join(dirname, Constants._SAVED_METRICS_FILE), "a"
          )
  
imports: import json
  import os
  from .None import constants
label_desc: Use image node_id 1 to create a new Logger object  with example: obj = Logger(dirname, config, overwrite, logging)