def METHOD_NAME(level, message, *args):
  """Conditionally logs `message % args` at the level `level`.
  Note that tensorboard_logging verbosity and logging verbosity are separate;
  the message will always be passed through to the logging module regardless of
  whether it passes the tensorboard_logging verbosity check.
  Args:
    level: The verbosity level to use. Must be one of
      tensorboard_logging.{DEBUG, INFO, WARN, ERROR, FATAL}.
    message: The message template to use.
    *args: Arguments to interpolate to the message template, if any.
  Raises:
    ValueError: If `level` is not a valid logging level.
    RuntimeError: If the `SummaryWriter` to use has not been set.
  """
  if _summary_writer is _sentinel_summary_writer:
    raise RuntimeError('Must call set_summary_writer before doing any '
                       'logging from tensorboard_logging')
  _check_verbosity(level)
  proto_level = _LEVEL_PROTO_MAP[level]
  if proto_level >= _LEVEL_PROTO_MAP[_verbosity]:
    log_message = event_pb2.LogMessage(level=proto_level,
                                       message=message % args)
    event = event_pb2.Event(wall_time=time.time(), log_message=log_message)
    if _summary_writer:
      _summary_writer.add_event(event)
  logging.METHOD_NAME(_PLATFORM_LOGGING_LEVEL_MAP[level], message, *args)