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

Q: Use in a concurrent environment #529

Open
richardtop opened this issue Apr 17, 2024 · 7 comments
Open

Q: Use in a concurrent environment #529

richardtop opened this issue Apr 17, 2024 · 7 comments

Comments

@richardtop
Copy link
Contributor

Hi, I'm curious whether it's allowed to use SwiftyBeaver in a concurrent environment. Let's consider we have 2 targets: an iOS app and an app extension, both are sharing the storage via the Shared Container.

Is there any limitation on whether we can log from both targets simultaneously? Should we implement the locking?

@skreutzberger
Copy link
Collaborator

Each destination has its own queue and SwiftyBeaver can be used in parallel environments.

@richardtop
Copy link
Contributor Author

So they can write to the same file? No conflicts etc? Thanks.

@skreutzberger
Copy link
Collaborator

What file do you mean?

@richardtop
Copy link
Contributor Author

i.e. using this: https://github.com/SwiftyBeaver/SwiftyBeaver/blob/master/Sources/FileDestination.swift
with a file url that is shared between an app target an an app extension, so that the logFileURL is pointing into a common container, https://developer.apple.com/documentation/foundation/nsfilemanager/1412643-containerurlforsecurityapplicati

@skreutzberger
Copy link
Collaborator

ah you are using the FileDestination. It was actually initially just meant to be used for local macOS development. So you are right, it may lead to conflicts.

@richardtop
Copy link
Contributor Author

Ok, then could you reopen this, as there is a way to implement it with the help of concurrent file operations (this is supported by the OS).

@skreutzberger skreutzberger reopened this Apr 24, 2024
@skreutzberger
Copy link
Collaborator

good idea, reopening and asking for contributions to extend the usability of the FileDestination to more than 1 consumer.

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

2 participants