<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def log_cmd(context, sampleinfo, sacct, quiet, config):
 """Log an analysis. CONFIG: MIP config file for an analysis """

    log_analysis = LogAnalysis(context.obj['store'])
    try:
        new_run = log_analysis(config, sampleinfo=sampleinfo, sacct=sacct)
    except MissingFileError as error:
        click.echo(click.style(f"Skipping, missing Sacct file: {error.message}", fg='yellow'))
        return
    except KeyError as error:
        print(click.style(f"unexpected output, missing key: {error.args[0]}", fg='yellow'))
        return
    if new_run is None:
        if not quiet:
            click.echo(click.style('Analysis already logged', fg='yellow'))
    else:
        message = f"New log added: {new_run.family} ({new_run.id}) - {new_run.status}"
        click.echo(click.style(message, fg='green'))