Commit d614086
feat(gl-sdk): add LogListener for foreign-binding log capture
Apps install a process-wide LogListener and receive every log message
emitted by gl-sdk and the underlying gl-client library. The bridge
sits on top of the `log` crate facade — gl-sdk's own `tracing` calls
are routed through `tracing`'s `log` feature, and gl-client's direct
`log::*!` calls flow through the same channel.
Public surface (free functions, not encumbering the Node entry
points):
- `set_logger(level, listener)` — install once per process.
- `set_log_level(level)` — adjust the filter at runtime.
- `LogEntry { level, message, target, file, line }` — record
forwarded to the listener.
- `LogLevel { Error, Warn, Info, Debug, Trace }`.
- `LogListener.on_log(entry)` — UniFFI callback interface.
Tests
- Python test_logging.py verifies LogLevel variants, LogEntry shape,
LogListener callback type, and that set_log_level is callable.
- Kotlin LoggingTest.kt installs the listener in @BeforeClass
(handling the "already installed" error gracefully) and asserts
that register_or_recover actually drives log entries through the
listener with non-empty targets.
Event-streaming changes (NodeEventListener trait, set_event_listener
on Node, the encumbering `event_listener` argument on register /
recover / connect / register_or_recover) are intentionally NOT in
this commit. The simple top-level functions stay 3-arg. Event
streaming can be reintroduced via the OOP / builder interface in a
separate PR.1 parent 7f8c28c commit d614086
7 files changed
Lines changed: 598 additions & 7 deletions
File tree
- libs
- gl-sdk-android/lib/src/androidInstrumentedTest/kotlin/com/blockstream/glsdk
- gl-sdk
- glsdk
- src
- tests
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 73 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
18 | 19 | | |
19 | 20 | | |
20 | 21 | | |
| |||
0 commit comments