def METHOD_NAME(monkeypatch, platform_env_var, access_token_env_var, logger_set):
    mock_mapi = MockMAPI()
    monkeypatch.setattr(mcli, 'update_run_metadata', mock_mapi.update_run_metadata)
    run_name = 'small_chungus'
    monkeypatch.setenv('RUN_NAME', run_name)
    monkeypatch.setenv(MOSAICML_PLATFORM_ENV_VAR, platform_env_var)
    monkeypatch.setenv(MOSAICML_ACCESS_TOKEN_ENV_VAR, access_token_env_var)
    trainer = Trainer(
        model=SimpleModel(),
        train_dataloader=DataLoader(RandomClassificationDataset()),
        train_subset_num_batches=2,
        max_duration='1ep',
        loggers=MosaicMLLogger() if logger_set else None,
    )
    logger_count = 0
    for callback in trainer.state.callbacks:
        if isinstance(callback, MosaicMLLogger):
            logger_count += 1
    # If logger is specified manually, ensure only 1
    if logger_set:
        assert logger_count == 1
    # Otherwise, auto-add only if platform and access token are set
    elif platform_env_var and access_token_env_var is not None:
        assert logger_count == 1
    # Otherwise, no logger
    else:
        assert logger_count == 0