def METHOD_NAME(self, extra_flags):
    with self.assertLogs() as logs:
        with tempfile.TemporaryDirectory("test_transformer_lm") as data_dir:
            create_dummy_data(data_dir, num_examples=20)
            preprocess_lm_data(data_dir)
            shutil.copyfile(f"{data_dir}/valid.bin", f"{data_dir}/valid1.bin")
            shutil.copyfile(f"{data_dir}/valid.idx", f"{data_dir}/valid1.idx")
            train_language_model(
                data_dir,
                "transformer_lm",
                ["--max-update", "0", "--log-format", "json"] + extra_flags,
                run_validation=False,
            )
    return [x.message for x in logs.records]