cln-plugin: Implement logging facade adapter for cln plugins

We wrap emitted messages into a JSON-RPC notification envelope and
write them to stdout. We use an indirection over an mpsc channel in
order to avoid deadlocks if we emit logs while holding the writer lock
on stdout.
This commit is contained in:
Christian Decker
2022-01-21 14:45:16 +01:00
committed by Rusty Russell
parent 9ae1f33992
commit f5e1829117
4 changed files with 118 additions and 20 deletions

View File

@@ -10,11 +10,11 @@ path = "examples/cln-plugin-startup.rs"
[dependencies]
anyhow = "1.0.51"
bytes = "1.1.0"
log = "0.4.14"
log = { version = "0.4.14", features = ['std'] }
serde = { version = "1.0.131", features = ["derive"] }
serde_json = "1.0.72"
tokio-util = { version = "0.6.9", features = ["codec"] }
tokio = { version="1", features = ['io-std', 'rt'] }
tokio = { version="1", features = ['io-std', 'rt', 'sync'] }
tokio-stream = "*"
futures = "0.3"
cln-rpc = { path = "../cln-rpc" }