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

[ios] add default OSLog Logger for ios>14.0 to release #8040

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

kirylkaveryn
Copy link
Contributor

@kirylkaveryn kirylkaveryn commented Apr 30, 2024

This PR adds logging using the default OSLogger for ios>14.0 during the release.
This PR does not affect the core logging.

Signed-off-by: Kiryl Kaveryn <kirylkaveryn@gmail.com>

if #available(iOS 14.0, *), enableLoggingInRelease {
os.Logger.logger.log(level: OSLogLevelFromLogLevel(level), "\(formattedMessage, privacy: .public)")
} else if Logger.canLog(level) {
Logger.log(level, message: formattedMessage)
Copy link
Member

Choose a reason for hiding this comment

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

Does it make sense to also log into this logger on iOS 14+?

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 are using this logger for swift to pass it to the core logger. But there only 2 places where the logging from swift is used now.
I don't think that it's useful to duplicate logging messages. But of them will be visible in the debugger.

@@ -27,18 +28,42 @@ func statusBarHeight() -> CGFloat {
return min(statusBarSize.height, statusBarSize.width)
}

private let enableLoggingInRelease = true
Copy link
Member

Choose a reason for hiding this comment

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

static?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In swift variables outside the types are already static. Compiler will warn if I add the satatic.

@rtsisyk
Copy link
Contributor

rtsisyk commented May 21, 2024

What is the current status here? @biodranik do you have any other comments?

@biodranik
Copy link
Member

This PR creates a separate independent logger from our existing C++ logs engine which logs only a few specific cases (now only iCloud).

It would be great to:

  1. Collect Swift/ObjC/C++ logs in a similar way/through one engine and
  2. Allow users to enable logs recording in the app settings, and then share the recorded log file with us via email or other messengers.

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.

None yet

3 participants