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

Allow static string to be used as key in macros #484

Closed
Thomasdezeeuw opened this issue Feb 21, 2022 · 1 comment · Fixed by #486
Closed

Allow static string to be used as key in macros #484

Thomasdezeeuw opened this issue Feb 21, 2022 · 1 comment · Fixed by #486

Comments

@Thomasdezeeuw
Copy link
Collaborator

Currently it uses an indent, which doesn't allow for static strings. I would like to be able to do the following:

log::warn!(trace = log::as_display!("some trace id"); "message"); // Ok.
log::warn!("logging.googleapis.com/trace" = log::as_display!("some trace id"); "message"); // Doesn't compile.

It could be that this is very niche and complex to implement, in which case we can continue using our work around.

Related #436, /cc @KodrAus

@KodrAus
Copy link
Contributor

KodrAus commented Feb 22, 2022

I think this is something that would be pretty straightfoward using a tt-muncher, which we're already going to need fairly soon. We'd just need to support both ident and literal matches in our match arms. If you pass something other than a string through then we'll catch it attempting to convert that value into a Key.

EFanZh pushed a commit to EFanZh/log that referenced this issue Jul 23, 2023
Bumps [mimalloc](https://github.com/purpleprotocol/mimalloc_rust) from 0.1.29 to 0.1.30.
- [Release notes](https://github.com/purpleprotocol/mimalloc_rust/releases)
- [Commits](purpleprotocol/mimalloc_rust@v0.1.29...v0.1.30)

---
updated-dependencies:
- dependency-name: mimalloc
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants