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 Logger.withMetadata() function to create a logger with multiple metadata values #321

Open
gabbifish opened this issue Sep 13, 2024 · 0 comments

Comments

@gabbifish
Copy link

gabbifish commented Sep 13, 2024

Expected behavior

Let’s say I have an existing Logger.Metadata struct I want to add to a Logger as metadata. It doesn’t seem like there is a simple function like Logger.withMetadata(metadata: Logger.Metadata) I can use. This means I have to iterate through every kv pair in my Logger.Metadata and add it to the logger with logger[key] = value, which is verbose.

(this withMetadata pattern is common in many logging libraries, so it would be great to have this as a convenience function in swift-log as well)

Actual behavior

N/A

Steps to reproduce

N/A

If possible, minimal yet complete reproducer code (or URL to code)

N/A

SwiftLog version/commit hash

1.6.1/9cb486020ebf03bfa5b5df985387a14a98744537

Swift & OS version (output of swift --version && uname -a)

swift-driver version: 1.90.11.1 Apple Swift version 5.10 (swiftlang-5.10.0.13 clang-1500.3.9.4)
Target: arm64-apple-macosx14.0
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

No branches or pull requests

1 participant