class_docstr: Helper handler to log engine's output and/or metrics
  
  Args:
      tag: common title for all produced plots. For example, "training"
      metric_names: list of metric names to plot or a string "all" to plot all available
          metrics.
      output_transform: output transform function to prepare `engine.state.output` as a number.
          For example, `output_transform = lambda output: output`
          This function can also return a dictionary, e.g `{"loss": loss1, "another_loss": loss2}` to label the plot
          with corresponding keys.
      global_step_transform: global step transform function to output a desired global step.
          Input of the function is `(engine, event_name)`. Output of function should be an integer.
          Default is None, global_step based on attached engine. If provided,
          uses function output as global_step. To setup global step from another engine, please use
          :meth:`~ignite.contrib.handlers.visdom_logger.global_step_from_engine`.
      show_legend: flag to show legend in the window
      state_attributes: list of attributes of the ``trainer.state`` to plot.
  
  Examples:
      .. code-block:: python
  
          from ignite.contrib.handlers.visdom_logger import *
  
          # Create a logger
          vd_logger = VisdomLogger()
  
          # Attach the logger to the evaluator on the validation dataset and log NLL, Accuracy metrics after
          # each epoch. We setup `global_step_transform=global_step_from_engine(trainer)` to take the epoch
          # of the `trainer`:
          vd_logger.attach(
              evaluator,
              log_handler=OutputHandler(
                  tag="validation",
                  metric_names=["nll", "accuracy"],
                  global_step_transform=global_step_from_engine(trainer)
              ),
              event_name=Events.EPOCH_COMPLETED
          )
          # or equivalently
          vd_logger.attach_output_handler(
              evaluator,
              event_name=Events.EPOCH_COMPLETED,
              tag="validation",
              metric_names=["nll", "accuracy"],
              global_step_transform=global_step_from_engine(trainer)
          )
  
      Another example, where model is evaluated every 500 iterations:
  
      .. code-block:: python
  
          from ignite.contrib.handlers.visdom_logger import *
  
          @trainer.on(Events.ITERATION_COMPLETED(every=500))
          def evaluate(engine):
              evaluator.run(validation_set, max_epochs=1)
  
          vd_logger = VisdomLogger()
  
          def global_step_transform(*args, **kwargs):
              return trainer.state.iteration
  
          # Attach the logger to the evaluator on the validation dataset and log NLL, Accuracy metrics after
          # every 500 iterations. Since evaluator engine does not have access to the training iteration, we
          # provide a global_step_transform to return the trainer.state.iteration for the global_step, each time
          # evaluator metrics are plotted on Visdom.
  
          vd_logger.attach_output_handler(
              evaluator,
              event_name=Events.EPOCH_COMPLETED,
              tag="validation",
              metrics=["nll", "accuracy"],
              global_step_transform=global_step_transform
          )
  
      Another example where the State Attributes ``trainer.state.alpha`` and ``trainer.state.beta``
      are also logged along with the NLL and Accuracy after each iteration:
  
      .. code-block:: python
  
          vd_logger.attach(
              trainer,
              log_handler=OutputHandler(
                  tag="training",
                  metric_names=["nll", "accuracy"],
                  state_attributes=["alpha", "beta"],
              ),
              event_name=Events.ITERATION_COMPLETED
          )
  
      Example of `global_step_transform`:
  
      .. code-block:: python
  
          def global_step_transform(engine, event_name):
              return engine.state.get_event_attrib_value(event_name)
code: def __init__(
      self,
      tag: str,
      metric_names: Optional[str] = None,
      output_transform: Optional[Callable] = None,
      global_step_transform: Optional[
          Callable[[Engine, Union[str, Events]], int]
      ] = None,
      show_legend: bool = False,
      state_attributes: Optional[List[str]] = None,
  ):
      super(OutputHandler, self).__init__(
          tag,
          metric_names,
          output_transform,
          global_step_transform,
          state_attributes,
      )
      _BaseVisDrawer.__init__(self, show_legend=show_legend)
  
imports: import os
  from typing import Any, Callable, cast, Dict, List, Optional, Union
  import torch
  import torch.nn
  from torch.optim import Optimizer
  from ignite.contrib.handlers.base_logger import BaseLogger, BaseOptimizerParamsHandler, BaseOutputHandler, BaseWeightsScalarHandler
  from ignite.engine import Engine, Events
  from ignite.handlers import global_step_from_engine
label_desc: Use image node_id 1 to create a new OutputHandler object from inherited base classes: BaseOutputHandler, _BaseVisDrawer with example: obj = OutputHandler(tag, metric_names, output_transform, global_step_transform, show_legend, state_attributes)