class_docstr: A Reporter object that abstracts various logging capabilities
  
  To set-up a Reporter, simply perform the following tasks:
  
  .. code-block:: python
  
      from pyswarms.utils import Reporter
  
      rep = Reporter()
      rep.log("Here's my message", lvl=logging.INFO)
  
  This will set-up a reporter with a default configuration that
  logs to a file, `report.log`, on the current working directory.
  You can change the log path by passing a string to the `log_path`
  parameter:
  
  .. code-block:: python
  
      from pyswarms.utils import Reporter
  
      rep = Reporter(log_path="/path/to/log/file.log")
      rep.log("Here's my message", lvl=logging.INFO)
  
  If you are working on a module and you have an existing logger,
  you can pass that logger instance during initialization:
  
  .. code-block:: python
  
      # mymodule.py
      from pyswarms.utils import Reporter
  
      # An existing logger in a module
      logger = logging.getLogger(__name__)
      rep = Reporter(logger=logger)
  
  Lastly, if you have your own logger configuration (YAML file),
  then simply pass that to the `config_path` parameter. This
  overrides the default configuration (including `log_path`):
  
  .. code-block:: python
  
      from pyswarms.utils import Reporter
  
      rep = Reporter(config_path="/path/to/config/file.yml")
      rep.log("Here's my message", lvl=logging.INFO)
class_docstr_tok: ["A","Reporter","object","that","abstracts","various","logging","capabilities","To","set-up","a","Reporter",",","simply","perform","the","following","tasks",":","..","code-block",":",":","python","from","pyswarms.utils","import","Reporter","rep","=","Reporter","(",")","rep.log","(","``","Here","'s","my","message","''",",","lvl=logging.INFO",")","This","will","set-up","a","reporter","with","a","default","configuration","that","logs","to","a","file",",","`","report.log","`",",","on","the","current","working","directory",".","You","can","change","the","log","path","by","passing","a","string","to","the","`","log_path","`","parameter",":","..","code-block",":",":","python","from","pyswarms.utils","import","Reporter","rep","=","Reporter","(","log_path=","''","\/path\/to\/log\/file.log","''",")","rep.log","(","``","Here","'s","my","message","''",",","lvl=logging.INFO",")","If","you","are","working","on","a","module","and","you","have","an","existing","logger",",","you","can","pass","that","logger","instance","during","initialization",":","..","code-block",":",":","python","#","mymodule.py","from","pyswarms.utils","import","Reporter","#","An","existing","logger","in","a","module","logger","=","logging.getLogger","(","__name__",")","rep","=","Reporter","(","logger=logger",")","Lastly",",","if","you","have","your","own","logger","configuration","(","YAML","file",")",",","then","simply","pass","that","to","the","`","config_path","`","parameter",".","This","overrides","the","default","configuration","(","including","`","log_path","`",")",":","..","code-block",":",":","python","from","pyswarms.utils","import","Reporter","rep","=","Reporter","(","config_path=","''","\/path\/to\/config\/file.yml","''",")","rep.log","(","``","Here","'s","my","message","''",",","lvl=logging.INFO",")"]
docstr: Set-up the logger with default values
  
  This method is called right after initializing the Reporter module.
  If no path is supplied, then it loads a default configuration.
  You can view the defaults via the Reporter._default_config attribute.
  
  
  Parameters
  ----------
  path : str, optional
      Path to a YAML configuration. If not supplied, uses
      a default config.
docstr_tok: ["Set-up","the","logger","with","default","values","This","method","is","called","right","after","initializing","the","Reporter","module",".","If","no","path","is","supplied",",","then","it","loads","a","default","configuration",".","You","can","view","the","defaults","via","the","Reporter._default_config","attribute",".","Parameters","--","--","--","--","--","path",":","str",",","optional","Path","to","a","YAML","configuration",".","If","not","supplied",",","uses","a","default","config","."]
code: def _setup_logger(self, path=None):
      """Set-up the logger with default values
  
      This method is called right after initializing the Reporter module.
      If no path is supplied, then it loads a default configuration.
      You can view the defaults via the Reporter._default_config attribute.
  
  
      Parameters
      ----------
      path : str, optional
          Path to a YAML configuration. If not supplied, uses
          a default config.
      """
      value = path or os.getenv(self._env_key, None)
      try:
          with open(value, "rt") as f:
              config = yaml.safe_load(f.read())
          logging.config.dictConfig(config)
      except (TypeError, FileNotFoundError):
          self._load_defaults()
  
file_path: pyswarms/pyswarms/utils/reporter/reporter.py
imports: import logging
  import logging.config
  import os
  import pprint
  import yaml
  from tqdm import trange
label_desc: Use image node_id 4 for calling the Reporter obj's underlying member method code with example usage: obj._setup_logger(path) without return types