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

[gardening]: logging utility method cleanup #155

Merged
merged 1 commit into from
Sep 2, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 6 additions & 9 deletions Workflow/Sources/WorkflowLogger.swift
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,7 @@ final class WorkflowLogger {
isRootNode: Bool
) {
if #available(iOS 12.0, macOS 10.14, *) {
guard shouldLogRenderTimingsForMode(
WorkflowLogging.config.renderLoggingMode,
guard shouldLogRenderTimings(
isRootNode: isRootNode
) else { return }

Expand All @@ -162,8 +161,7 @@ final class WorkflowLogger {
isRootNode: Bool
) {
if #available(iOS 12.0, macOS 10.14, *) {
guard shouldLogRenderTimingsForMode(
WorkflowLogging.config.renderLoggingMode,
guard shouldLogRenderTimings(
isRootNode: isRootNode
) else { return }

Expand All @@ -174,16 +172,15 @@ final class WorkflowLogger {

// MARK: - Utilities

private static func shouldLogRenderTimingsForMode(
_ renderLoggingMode: WorkflowLogging.Config.RenderLoggingMode,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

we're just using the static config value, so dropped the unused parameter.

private static func shouldLogRenderTimings(
isRootNode: Bool
) -> Bool {
switch WorkflowLogging.config.renderLoggingMode {
case .none:
return false
case .rootsOnly where !isRootNode:
return false
default:
case .rootsOnly:
return isRootNode
case .allNodes:
return true
}
}
Expand Down