Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for logging with more than 6 arguments at runtime #55525

Open
1 task
Tracked by #64015 ...
maryamariyan opened this issue Jul 12, 2021 · 3 comments
Open
1 task
Tracked by #64015 ...

Add support for logging with more than 6 arguments at runtime #55525

maryamariyan opened this issue Jul 12, 2021 · 3 comments
Labels
api-suggestion Early API idea and discussion, it is NOT ready for implementation area-Extensions-Logging
Milestone

Comments

@maryamariyan
Copy link
Member

maryamariyan commented Jul 12, 2021

Background and Motivation

As part of .NET 6 we updated the new LoggerMessage.Define overloads to use LogDefineOptions. (PR here and issue #50913)

Later in .NET 7, for supporting more arguments, we could add a new Define<T> API (where T is a delegate) that would take n arguments, log level, event ID, format string and LogDefineOptions to log message.

Theoretically we need an analyzer that makes sure the arguments of the new Define API are proper (ILogger etc.). The source generator would not be using the new Define (where T is delegate) API. (not source gen friendly).

We welcome API proposals! We have a process to evaluate the value and shape of new API. There is an overview of our process . This template will help us gather the information we need to start the review process.
First, please describe the purpose and value of the new API here.

Proposed API

Something like:

public static partial class LoggerMessage
{
+    public static void Define<T>(Microsoft.Extensions.Logging.LogLevel logLevel, Microsoft.Extensions.Logging.EventId eventId, string formatString, Microsoft.Extensions.Logging.LogOptions options) where T : delegate {​ throw null; }​
}

T would be a delegate but an analyzer would need to make sure it takes ILogger, Exception, etc. System.Action<Microsoft.Extensions.Logging.ILogger, T1, T2, ..., Tn, System.Exception?>

TODO

cc: @davidfowl @eerhardt

@maryamariyan maryamariyan added api-suggestion Early API idea and discussion, it is NOT ready for implementation area-Extensions-Logging labels Jul 12, 2021
@ghost
Copy link

ghost commented Jul 12, 2021

Tagging subscribers to this area: @maryamariyan
See info in area-owners.md if you want to be subscribed.

Issue Details

Background and Motivation

As part of .NET 6 we updated the new LoggerMessage.Define overloads to use LogDefineOptions. (PR here and issue here)

Later in .NET 7, for supporting more arguments, we could add a new Define<T> API (where T is a delegate) that would take n arguments, log level, event ID, format string and LogDefineOptions to log message.

Theoretically we need an analyzer that makes sure the arguments of the new Define API are proper (ILogger etc.). The source generator would not be using the new Define (where T is delegate) API. (not source gen friendly).

We welcome API proposals! We have a process to evaluate the value and shape of new API. There is an overview of our process . This template will help us gather the information we need to start the review process.
First, please describe the purpose and value of the new API here.

Proposed API

Something like:

public static partial class LoggerMessage
{
+    public static void Define<T>(Microsoft.Extensions.Logging.LogLevel logLevel, Microsoft.Extensions.Logging.EventId eventId, string formatString, Microsoft.Extensions.Logging.LogOptions options) where T : delegate {​ throw null; }​
}

T would be a delegate but an analyzer would need to make sure it takes ILogger, Exception, etc. System.Action<Microsoft.Extensions.Logging.ILogger, T1, T2, ..., Tn, System.Exception?>

TODO

cc: @davidfowl @eerhardt

Author: maryamariyan
Assignees: -
Labels:

api-suggestion, area-Extensions-Logging

Milestone: -

@dotnet-issue-labeler dotnet-issue-labeler bot added the untriaged New issue has not been triaged by the area owner label Jul 12, 2021
@maryamariyan maryamariyan removed the untriaged New issue has not been triaged by the area owner label Jul 12, 2021
@maryamariyan maryamariyan added this to the 7.0.0 milestone Jul 12, 2021
@maryamariyan maryamariyan self-assigned this Jul 12, 2021
@maryamariyan maryamariyan modified the milestones: 7.0.0, 8.0.0 Jun 14, 2022
@maryamariyan maryamariyan removed their assignment Jan 9, 2023
@tarekgh tarekgh modified the milestones: 8.0.0, 9.0.0 Jul 25, 2023
@tarekgh tarekgh modified the milestones: 9.0.0, Future Nov 20, 2023
@abatishchev
Copy link
Contributor

@tarekgh any update on this, please?

@tarekgh
Copy link
Member

tarekgh commented Jun 2, 2024

We couldn't get into this yet because we are occupied with other high-priority tasks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api-suggestion Early API idea and discussion, it is NOT ready for implementation area-Extensions-Logging
Projects
None yet
Development

No branches or pull requests

3 participants