Skip to content

Commit 3974be2

Browse files
committed
Set up Android and iOS logging
The correct deps and code will be compiled in depending on the target platform. Also adds an init_convex_logging function exposed over FFI for the client to enable the logging functionality.
1 parent 92c16e4 commit 3974be2

File tree

5 files changed

+253
-33
lines changed

5 files changed

+253
-33
lines changed

rust/Cargo.lock

Lines changed: 158 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

rust/Cargo.toml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,32 @@ async-once-cell = { version = "0.5.3" }
1919
serde_json = { version = "1.0.120" }
2020
rustls = { version = "0.23", features = ["aws-lc-rs"] }
2121
aws-lc-rs = { version = "1.14", features = ["bindgen"], optional = true }
22+
tracing = "0.1"
23+
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
2224

2325
[features]
2426
default = ["aws-lc-rs"]
27+
max_level_off = ["tracing/max_level_off"]
28+
max_level_error = ["tracing/max_level_error"]
29+
max_level_warn = ["tracing/max_level_warn"]
2530

2631
[dev-dependencies]
2732
maplit = { version = "1" }
2833

2934
[build-dependencies]
3035
uniffi = { version = "0.28", features = [ "build" ]}
3136

37+
[target.'cfg(target_os = "android")'.dependencies]
38+
tracing-android = "0.2"
39+
android_logger = "0.14"
40+
41+
[target.'cfg(target_os = "ios")'.dependencies]
42+
tracing-oslog = "0.3"
43+
oslog = "0.2"
44+
45+
[profile.release]
46+
features = ["max_level_warn"]
47+
3248
[lib]
3349
crate-type = ["cdylib", "lib", "staticlib"]
3450
name = "convexmobile"

rust/src/convex-mobile.udl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
namespace convexmobile {};
1+
namespace convexmobile {
2+
void init_convex_logging();
3+
};
24

35
[Error]
46
interface ClientError {

0 commit comments

Comments
 (0)