mirror of
https://github.com/bevyengine/bevy
synced 2024-12-30 06:53:13 +00:00
6a39c33d49
# Objective On mobile devices, it's best to use the OS's native logging due to the difficulty of accessing the console. This is already done for Android. This is an updated version of https://github.com/bevyengine/bevy/pull/4462. ## Solution This PR uses Absolucy's [tracing-oslog](https://github.com/Absolucy/tracing-oslog) ([ZLib license](https://github.com/Absolucy/tracing-oslog/blob/main/LICENSE.md)) for iOS in order to use Apple's `os_log`. ## Testing I ran `examples/mobile` with the logging from `examples/app/logs.rs` on an iOS device, I then checked the logs could be filtered in the MacOS Console.app. ## Changelog - Change bevy_log to use Apple's os_log on iOS. ## Questions for Reviewers It's worth noting that the dependency this adds hasn't had bug fixes released in a few years, so we may want to consider one or more of: 1. a feature flag to opt-in, and it would also allow `os_log` on MacOS 2. merge as-is and have some (minor?) upstream bugs 3. hold off on this PR until a suitable alternative dependency arises 4. maintain our own implementation ## Future work In a follow-up PR it might be good to make the `subsystem` field have a better default value, like [this one](https://github.com/bevyengine/bevy/blob/main/examples/mobile/bevy_mobile_example.xcodeproj/project.pbxproj#L363). That value can be retrieved programmatically if we bind another system API (For posterity in Swift this is `Bundle.main.bundleIdentifier`, but the C/ObjC equivalent is likely easier to bind). This would almost always be the correct value, while the current default is unlikely to ever be correct. --------- Co-authored-by: Dusty DeWeese <dustin.deweese@gmail.com> Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com> Co-authored-by: Carter Anderson <mcanders1@gmail.com> Co-authored-by: François Mockers <francois.mockers@vleue.com>
47 lines
1.3 KiB
TOML
47 lines
1.3 KiB
TOML
[package]
|
|
name = "bevy_log"
|
|
version = "0.15.0-dev"
|
|
edition = "2021"
|
|
description = "Provides logging for Bevy Engine"
|
|
homepage = "https://bevyengine.org"
|
|
repository = "https://github.com/bevyengine/bevy"
|
|
license = "MIT OR Apache-2.0"
|
|
keywords = ["bevy"]
|
|
|
|
[features]
|
|
trace = ["tracing-error"]
|
|
trace_tracy_memory = ["dep:tracy-client"]
|
|
|
|
[dependencies]
|
|
bevy_app = { path = "../bevy_app", version = "0.15.0-dev" }
|
|
bevy_utils = { path = "../bevy_utils", version = "0.15.0-dev" }
|
|
bevy_ecs = { path = "../bevy_ecs", version = "0.15.0-dev" }
|
|
|
|
tracing-subscriber = { version = "0.3.1", features = [
|
|
"registry",
|
|
"env-filter",
|
|
] }
|
|
tracing-chrome = { version = "0.7.0", optional = true }
|
|
tracing-log = "0.2.0"
|
|
tracing-error = { version = "0.2.0", optional = true }
|
|
|
|
# Tracy dependency compatibility table:
|
|
# https://github.com/nagisa/rust_tracy_client
|
|
tracing-tracy = { version = "0.11.0", optional = true }
|
|
tracy-client = { version = "0.17.0", optional = true }
|
|
|
|
[target.'cfg(target_os = "android")'.dependencies]
|
|
android_log-sys = "0.3.0"
|
|
|
|
[target.'cfg(target_arch = "wasm32")'.dependencies]
|
|
tracing-wasm = "0.2.1"
|
|
|
|
[target.'cfg(target_os = "ios")'.dependencies]
|
|
tracing-oslog = "0.2"
|
|
|
|
[lints]
|
|
workspace = true
|
|
|
|
[package.metadata.docs.rs]
|
|
rustdoc-args = ["-Zunstable-options", "--generate-link-to-definition"]
|
|
all-features = true
|