code: def test__training_step__log(tmpdir):
      """Tests that only training_step can be used."""
  
      class TestModel(BoringModel):
          def training_step(self, batch, batch_idx):
              out = super().training_step(batch, batch_idx)
              loss = out["loss"]
  
              # -----------
              # default
              # -----------
              self.log("default", loss)
  
              # -----------
              # logger
              # -----------
              # on_step T on_epoch F
              self.log(
                  "l_s",
                  loss,
                  on_step=True,
                  on_epoch=False,
                  prog_bar=False,
                  logger=True,
              )
  
              # on_step F on_epoch T
              self.log(
                  "l_e",
                  loss,
                  on_step=False,
                  on_epoch=True,
                  prog_bar=False,
                  logger=True,
              )
  
              # on_step T on_epoch T
              self.log(
                  "l_se",
                  loss,
                  on_step=True,
                  on_epoch=True,
                  prog_bar=False,
                  logger=True,
              )
  
              # -----------
              # pbar
              # -----------
              # on_step T on_epoch F
              self.log(
                  "p_s",
                  loss,
                  on_step=True,
                  on_epoch=False,
                  prog_bar=True,
                  logger=False,
              )
  
              # on_step F on_epoch T
              self.log(
                  "p_e",
                  loss,
                  on_step=False,
                  on_epoch=True,
                  prog_bar=True,
                  logger=False,
              )
  
              # on_step T on_epoch T
              self.log(
                  "p_se",
                  loss,
                  on_step=True,
                  on_epoch=True,
                  prog_bar=True,
                  logger=False,
              )
  
              return loss
  
      model = TestModel()
      model.val_dataloader = None
  
      trainer = Trainer(
          default_root_dir=tmpdir,
          limit_train_batches=2,
          limit_val_batches=2,
          max_epochs=2,
          log_every_n_steps=1,
          enable_model_summary=False,
          callbacks=[ModelCheckpoint(monitor="l_se")],
      )
      trainer.fit(model)
  
      logged_metrics = set(trainer.logged_metrics)
      assert logged_metrics == {
          "default",
          "l_e",
          "l_s",
          "l_se_step",
          "l_se_epoch",
      }
  
      pbar_metrics = set(trainer.progress_bar_metrics)
      assert pbar_metrics == {"p_e", "p_s", "p_se_step", "p_se_epoch"}
  
      assert set(trainer.callback_metrics) == (
          logged_metrics | pbar_metrics | {"p_se", "l_se"}
      )
      assert all(
          isinstance(v, Tensor)
          for v in trainer.callback_metrics.values()
      )
      assert all(
          isinstance(v, Tensor) for v in trainer.logged_metrics.values()
      )
      assert all(
          isinstance(v, float)
          for v in trainer.progress_bar_metrics.values()
      )
  
imports: import collections
  import itertools
  from re import escape
  from unittest import mock
  from unittest.mock import call
  import numpy
  import pytest
  import torch
  from lightning.pytorch import Trainer, callbacks
  from lightning.pytorch.callbacks import EarlyStopping, ModelCheckpoint, TQDMProgressBar
  from lightning.pytorch.core.module import LightningModule
  from lightning.pytorch.demos.boring_classes import BoringModel, RandomDataset, RandomDictDataset
  from lightning.pytorch.loggers.tensorboard import TensorBoardLogger
  from lightning.pytorch.trainer.states import RunningStage
  from lightning.pytorch.utilities.exceptions import MisconfigurationException
  from lightning.pytorch.utilities.imports import _TORCHMETRICS_GREATER_EQUAL_0_11
  from lightning_utilities.test.warning import no_warning_call
  from torch import Tensor
  from torch.utils.data import DataLoader
  from torchmetrics import Accuracy
  from tests_pytorch.helpers.runif import RunIf
label_desc: Use image node_id 1 for calling a global function with example usage: test__training_step__log(tmpdir) and returns: loss