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

fix: Change logger params to @autoclosures #1827

Merged
merged 4 commits into from
Nov 21, 2024
Merged

Conversation

jbelkins
Copy link
Contributor

@jbelkins jbelkins commented Nov 20, 2024

Description of changes

smithy-lang/smithy-swift#865 adds @autoclosure to three logger params on the LogAgent protocol.

This PR updates a test logger to conform.

New/existing dependencies impact assessment, if applicable

No new dependencies were added to this change.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

func log(level: LogAgentLevel = .info, message: String, metadata: [String : String]? = nil, source: String = "ChecksumUnitTests", file: String = #file, function: String = #function, line: UInt = #line) {
messages.append((level: level, message: message))
func log(level: LogAgentLevel = .info, message: @autoclosure () -> String, metadata: @autoclosure () -> [String : String]? = nil, source: @autoclosure () -> String = "ChecksumUnitTests", file: String = #file, function: String = #function, line: UInt = #line) {
messages.append((level: level, message: message()))
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change message, metadata, and source to @autoclosures to match the LogAgent protocol.

Note that message is now a closure & must be called to get its string value.

@jbelkins jbelkins marked this pull request as ready for review November 20, 2024 18:35
@jbelkins jbelkins merged commit b506c48 into main Nov 21, 2024
29 checks passed
@jbelkins jbelkins deleted the jbe/autoclosure_log_params branch November 21, 2024 21:41
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 this pull request may close these issues.

2 participants