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

Feature - NSLog and Print ConsoleWriter #15

Merged
merged 2 commits into from
Sep 7, 2016

Conversation

cnoon
Copy link
Member

@cnoon cnoon commented Aug 17, 2016

This PR adds a Method enum to the ConsoleWriter class to allow you to select whether to use print or NSLog internally. The differences as to using one vs. the other is called out in the enum docstring.

The reason to switch between these is that you want to use either the os_log APIs or NSLog when running on a device. Otherwise, none of the log messages will appear in the device console.

@cnoon cnoon added this to the 2.0.0 milestone Aug 17, 2016
@cnoon cnoon assigned cnoon, EricAppel and AtomicCat and unassigned cnoon Aug 17, 2016
/// During development, it is recommended to use the `.print` case. When deploying to production, the `.nslog`
/// case should be used.
///
/// - print: The Swift `print` function that is faster, not thread safe and doesn't write to the device console.
Copy link
Contributor

Choose a reason for hiding this comment

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

This would imply that if you have multiple loggers not all using the same queue, the default of .print may lead to crashes?

Copy link
Member Author

Choose a reason for hiding this comment

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

Whoops, let me rephrase. Good catch!

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed in 8f015d0.

@cnoon cnoon force-pushed the feature/os_log_writer branch from eed7f4c to e256d30 Compare September 7, 2016 16:05
@cnoon cnoon force-pushed the feature/nslog-and-print-console-writer branch from aa62758 to fde35a6 Compare September 7, 2016 16:06
@cnoon cnoon changed the base branch from feature/os_log_writer to swift3 September 7, 2016 16:06
@cnoon
Copy link
Member Author

cnoon commented Sep 7, 2016

All comments have been addressed, I'm going to move this PR through.

Thanks gents! 🍻

@cnoon cnoon merged commit d99bfa5 into swift3 Sep 7, 2016
@cnoon cnoon deleted the feature/nslog-and-print-console-writer branch September 7, 2016 16:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants