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

[SR-8601] OSLog.Category shouldn't have the same availability as os_signpost #51117

Open
zwaldowski opened this issue Aug 22, 2018 · 4 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. SDKOverlay standard library Area: Standard library umbrella

Comments

@zwaldowski
Copy link

Previous ID SR-8601
Radar rdar://problem/43895551
Original Reporter @zwaldowski
Type Bug
Environment

Xcode Version 10.0 beta 6 (10L232m) - Apple Swift version 4.2 (swiftlang-1000.0.36 clang-1000.10.44)

Additional Detail from JIRA
Votes 0
Component/s Standard Library
Labels Bug, SDKOverlay
Assignee None
Priority Medium

md5: 1a67def71230ca0eddbae84dd1ab0e60

Issue Description:

See here. If OSLog.Category is meant as an extensible string enum/dumping ground for user categories, and calls through to the existing string-based initializers, the Category overlay shouldn't be declared with the same availability as os_signpost.

@belkadan
Copy link
Contributor

Lance (JIRA User), @moiseev, can you check with the OSLog folks about this?

@moiseev
Copy link
Mannequin

moiseev mannequin commented Aug 30, 2018

@swift-ci create

@moiseev
Copy link
Mannequin

moiseev mannequin commented Aug 30, 2018

@zwaldowski Could you please clarify what you mean by "shouldn't be declared with the same availability as `os_signpost`"?

There is currently an os_log API that allows custom user-defined categories passed in as regular String s: https://github.com/apple/swift/blob/master/stdlib/public/SDK/os/os_log.swift#L89-L92

The OSLog.Category type and the corresponding OSLog initializer are only meant to provide a pre-defined pointOfInterest category in a type-safe way.

As can be seen in the tests here: https://github.com/apple/swift/blob/master/test/stdlib/os.swift#L38-L53 it is possible to use both os_log and os_signpost with OSLog instances created using either of the initializers.

@zwaldowski
Copy link
Author

It seemed like it was intended as a declaration for an open string enum. If not, it's surprising that its initializer is public. That it steals the useful name "Category" then implicitly slaps a 10.14 deployment target on it makes it surpassingly annoying to safely declare a list of your own app's categories, like our project was doing prior to 4.2.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. SDKOverlay standard library Area: Standard library umbrella
Projects
None yet
Development

No branches or pull requests

2 participants