class_docstr: Test cases for diagnostics emitted by the Dynamo ONNX export code.
class_docstr_tok: ["Test","cases","for","diagnostics","emitted","by","the","Dynamo","ONNX","export","code","."]
code: def test_log_is_recorded_in_sarif_additional_messages_according_to_diagnostic_options_verbosity_level(
      self,
  ):
      logging_levels = [
          logging.DEBUG,
          logging.INFO,
          logging.WARNING,
          logging.ERROR,
      ]
      for verbosity_level in logging_levels:
          self.diagnostic_context.options.verbosity_level = (
              verbosity_level
          )
          with self.diagnostic_context:
              diagnostic = fx_diagnostics.Diagnostic(
                  self.rules.rule_without_message_args, infra.Level.NONE
              )
              additional_messages_count = len(
                  diagnostic.additional_messages
              )
              for log_level in logging_levels:
                  diagnostic.log(level=log_level, message="log message")
                  if log_level >= verbosity_level:
                      self.assertGreater(
                          len(diagnostic.additional_messages),
                          additional_messages_count,
                          f"Additional message should be recorded when log level is {log_level} "
                          f"and verbosity level is {verbosity_level}",
                      )
                  else:
                      self.assertEqual(
                          len(diagnostic.additional_messages),
                          additional_messages_count,
                          f"Additional message should not be recorded when log level is "
                          f"{log_level} and verbosity level is {verbosity_level}",
                      )
  
imports: from __future__ import annotations
  import contextlib
  import dataclasses
  import io
  import logging
  import typing
  import unittest
  from typing import AbstractSet, Protocol, Tuple
  import torch
  from torch.onnx import errors
  from torch.onnx._internal import diagnostics
  from torch.onnx._internal.diagnostics import infra
  from torch.onnx._internal.diagnostics.infra import formatter, sarif
  from torch.onnx._internal.fx import diagnostics
  from torch.testing._internal import common_utils, logging_utils
label_desc: Use image node_id 2 for calling the TestDynamoOnnxDiagnostics obj's underlying member method code with example usage: obj.test_log_is_recorded_in_sarif_additional_messages_according_to_diagnostic_options_verbosity_level() without return types