class_docstr: Base logger handler. See implementations: TensorboardLogger, VisdomLogger, PolyaxonLogger, MLflowLogger, ...
class_docstr_tok: ["Base","logger","handler",".","See","implementations",":","TensorboardLogger",",","VisdomLogger",",","PolyaxonLogger",",","MLflowLogger",",","..."]
docstr: Attach the logger to the engine and execute `log_handler` function at `event_name` events.
  
  Args:
      engine: engine object.
      log_handler: a logging handler to execute
      event_name: event to attach the logging handler to. Valid events are from
          :class:`~ignite.engine.events.Events` or :class:`~ignite.engine.events.EventsList` or any `event_name`
          added by :meth:`~ignite.engine.engine.Engine.register_events`.
      args: args forwarded to the `log_handler` method
      kwargs: kwargs forwarded to the  `log_handler` method
  
  Returns:
      :class:`~ignite.engine.events.RemovableEventHandle`, which can be used to remove the handler.
docstr_tok: ["Attach","the","logger","to","the","engine","and","execute","`","log_handler","`","function","at","`","event_name","`","events",".","Args",":","engine",":","engine","object",".","log_handler",":","a","logging","handler","to","execute","event_name",":","event","to","attach","the","logging","handler","to",".","Valid","events","are","from",":","class",":","`","~ignite.engine.events.Events","`","or",":","class",":","`","~ignite.engine.events.EventsList","`","or","any","`","event_name","`","added","by",":","meth",":","`","~ignite.engine.engine.Engine.register_events","`",".","args",":","args","forwarded","to","the","`","log_handler","`","method","kwargs",":","kwargs","forwarded","to","the","`","log_handler","`","method","Returns",":",":","class",":","`","~ignite.engine.events.RemovableEventHandle","`",",","which","can","be","used","to","remove","the","handler","."]
code: def attach(
      self,
      engine: Engine,
      log_handler: Callable,
      event_name: Union[
          str, Events, CallableEventWithFilter, EventsList
      ],
      *args: Any,
      **kwargs: Any,
  ) -> RemovableEventHandle:
      """Attach the logger to the engine and execute `log_handler` function at `event_name` events.
  
      Args:
          engine: engine object.
          log_handler: a logging handler to execute
          event_name: event to attach the logging handler to. Valid events are from
              :class:`~ignite.engine.events.Events` or :class:`~ignite.engine.events.EventsList` or any `event_name`
              added by :meth:`~ignite.engine.engine.Engine.register_events`.
          args: args forwarded to the `log_handler` method
          kwargs: kwargs forwarded to the  `log_handler` method
  
      Returns:
          :class:`~ignite.engine.events.RemovableEventHandle`, which can be used to remove the handler.
      """
      if isinstance(event_name, EventsList):
          for name in event_name:
              if name not in State.event_to_attr:
                  raise RuntimeError(f"Unknown event name '{name}'")
              engine.add_event_handler(name, log_handler, self, name)
  
          return RemovableEventHandle(event_name, log_handler, engine)
  
      else:
          if event_name not in State.event_to_attr:
              raise RuntimeError(f"Unknown event name '{event_name}'")
  
          return engine.add_event_handler(
              event_name, log_handler, self, event_name, *args, **kwargs
          )
  
imports: import numbers
  import warnings
  from abc import ABCMeta, abstractmethod
  from collections import OrderedDict
  from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, Union
  import torch
  import torch.nn
  from torch.optim import Optimizer
  from ignite.engine import Engine, Events, EventsList, State
  from ignite.engine.events import CallableEventWithFilter, RemovableEventHandle
label_desc: Use image node_id 1 for calling the BaseLogger obj's underlying member method code with example usage: obj.attach(engine, log_handler, event_name) and returns: RemovableEventHandle, engine