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

[performance]: disable logging by default & add logging configuration #151

Merged
merged 4 commits into from
Aug 19, 2022

Conversation

jamieQ
Copy link
Contributor

@jamieQ jamieQ commented Aug 17, 2022

Background

  • during some recent investigations into rendering performance, we found that leaving the runtime os logging enabled (the current implicit behavior) had a noticeable adverse effect.

Changes

  • logging is now opt-in, and disabled by default
  • added additional configuration options to control which categories of runtime data are logged
  • added synthetic performance tests to gut check execution time changes under various logging configurations

example XCTest run after disabling logging:
Screen Shot 2022-08-17 at 14 30 31

Checklist

  • Unit Tests
  • I have made corresponding changes to the documentation
  • TODO: apply changes to assorted WorkerLogger implementations

@CLAassistant
Copy link

CLAassistant commented Aug 17, 2022

CLA assistant check
All committers have signed the CLA.

@jamieQ jamieQ marked this pull request as ready for review August 18, 2022 12:56
static let workflow = OSLog(subsystem: "com.squareup.Workflow", category: "Workflow")

/// The active log handle to use when logging. Defaults to the shared `.disabled` handle.
static var active: OSLog = .disabled
Copy link
Contributor Author

Choose a reason for hiding this comment

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

cribbing the analogous Blueprint approach to this

Copy link
Contributor

Choose a reason for hiding this comment

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

Note: Recently changed this a bit, in particular making this a private (set) and checking isEnabled and bailing early from methods: square/Blueprint#364

}

/// Configuration options used to determine which activities are logged.
public static var config: Config = .debug
Copy link
Contributor Author

Choose a reason for hiding this comment

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

maybe should default to the reduced logging config? 🤷

Copy link
Contributor

Choose a reason for hiding this comment

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

I think that seems correct

@jamieQ jamieQ changed the title [performance]: add logging configuration & disable logging by default [performance]: disable logging by default & add logging configuration Aug 19, 2022
@jamieQ jamieQ merged commit 1ee49f2 into main Aug 19, 2022
@jamieQ jamieQ deleted the jquadri/logging-config branch August 19, 2022 14:54
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.

4 participants