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

Improve [TagName] support in [LoggerMessage] source-gen #4848

Closed
xakep139 opened this issue Jan 2, 2024 · 0 comments · Fixed by #4851
Closed

Improve [TagName] support in [LoggerMessage] source-gen #4848

xakep139 opened this issue Jan 2, 2024 · 0 comments · Fixed by #4851

Comments

@xakep139
Copy link
Contributor

xakep139 commented Jan 2, 2024

Currently, the [TagName] behavior doesn't allow specifying non-alphanumeric names in a message format string:

[LoggerMessage(LogLevel.Debug, "The method is {http.request.method}")]
static partial void Log([TagName("http.request.method")] string method);
geeknoid pushed a commit that referenced this issue Jan 3, 2024
- When using [TagName] to control the name of a logging tag, the
expectation is that the logging message (if present) should be using
the tag name instead of the parameter name. SO:

```
[LoggerMessage(1, LogLevel.Information, "My message {foo.bar}")]
public static partial void Log(this ILogger logger, [TagName("foo.bar") string msg);
```

Fixes #4848
@ghost ghost added the work in progress 🚧 label Jan 3, 2024
@xakep139 xakep139 changed the title Improve [TagNames] support in [LoggerMessage] source-gen Improve [TagName] support in [LoggerMessage] source-gen Jan 3, 2024
geeknoid pushed a commit that referenced this issue Jan 3, 2024
- When using [TagName] to control the name of a logging tag, the
expectation is that the logging message (if present) should be using
the tag name instead of the parameter name. SO:

```
[LoggerMessage(1, LogLevel.Information, "My message {foo.bar}")]
public static partial void Log(this ILogger logger, [TagName("foo.bar") string msg);
```

Fixes #4848
geeknoid added a commit that referenced this issue Jan 3, 2024
- When using [TagName] to control the name of a logging tag, the
expectation is that the logging message (if present) should be using
the tag name instead of the parameter name. SO:

```
[LoggerMessage(1, LogLevel.Information, "My message {foo.bar}")]
public static partial void Log(this ILogger logger, [TagName("foo.bar") string msg);
```

Fixes #4848

Co-authored-by: Martin Taillefer <[email protected]>
@github-actions github-actions bot locked and limited conversation to collaborators Feb 3, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant