docstr: Check if the logging levels are allowed in the given hook.
docstr_tok: ["Check","if","the","logging","levels","are","allowed","in","the","given","hook","."]
code: def check_logging_levels(
      cls, fx_name: str, on_step: bool, on_epoch: bool
  ) -> None:
      """Check if the logging levels are allowed in the given hook."""
      fx_config = cls.functions[fx_name]
      assert fx_config is not None
      m = "You can't `self.log({}={})` inside `{}`, must be one of {}."
      if on_step not in fx_config["allowed_on_step"]:
          msg = m.format(
              "on_step", on_step, fx_name, fx_config["allowed_on_step"]
          )
          raise MisconfigurationException(msg)
  
      if on_epoch not in fx_config["allowed_on_epoch"]:
          msg = m.format(
              "on_epoch",
              on_epoch,
              fx_name,
              fx_config["allowed_on_epoch"],
          )
          raise MisconfigurationException(msg)
  
file_path: pytorch-lightning/src/lightning/pytorch/trainer/connectors/logger_connector/fx_validator.py
imports: from typing import Optional, Tuple, Union
  from typing_extensions import TypedDict
  from lightning.pytorch.utilities.exceptions import MisconfigurationException
label_desc: Use image node_id 3 for calling the _FxValidator obj's underlying member method code with example usage: obj.check_logging_levels(cls, fx_name, on_step, on_epoch) without return types