Skip to content

[API Proposal]: ConsoleFormatterOptions.IncludeCategory/ConsoleFormatterOptions.IncludeEventId #120689

@bill-poole

Description

@bill-poole

Background and motivation

The console log output format can be quite cluttered with the category and event ID. It would be great if we could opt for the category and/or event ID to be omitted from the console output. I have written my own custom console formatter to achieve this and have found the console output to be significantly more readable. It would be great if this could be achieved with the provided SimpleConsoleFormatter.

API Proposal

namespace Microsoft.Extensions.Logging.Console;

public class ConsoleFormatterOptions
{
    public bool IncludeCategory { get; set; } = true;

    public bool IncludeEventId { get; set; } = true;
}

API Usage

builder.Logging.AddConsole(options => options.AddConsoleFormatter(options =>
{
    options.IncludeCategory = false;
    options.IncludeEventId = false;
}));

Alternative Designs

No response

Risks

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions