mirror of
https://github.com/asciinema/asciinema.git
synced 2025-12-15 19:28:00 +01:00
Write user notifications to streamer's log file
This commit is contained in:
13
Cargo.lock
generated
13
Cargo.lock
generated
@@ -115,6 +115,7 @@ dependencies = [
|
||||
"tokio",
|
||||
"tokio-stream",
|
||||
"tower-http",
|
||||
"tracing",
|
||||
"tracing-subscriber",
|
||||
"uuid",
|
||||
"which",
|
||||
@@ -2281,9 +2282,21 @@ checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef"
|
||||
dependencies = [
|
||||
"log",
|
||||
"pin-project-lite",
|
||||
"tracing-attributes",
|
||||
"tracing-core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tracing-attributes"
|
||||
version = "0.1.27"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.38",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tracing-core"
|
||||
version = "0.1.32"
|
||||
|
||||
@@ -33,4 +33,5 @@ tokio-stream = { version = "0.1.14", features = ["sync"] }
|
||||
rust-embed = "8.2.0"
|
||||
mime_guess = "2.0.4"
|
||||
tower-http = { version = "0.5.1", features = ["trace"] }
|
||||
tracing = "0.1.40"
|
||||
tracing-subscriber = { version = "0.3.18", features = ["env-filter"] }
|
||||
|
||||
@@ -11,6 +11,7 @@ use std::net::{self, TcpListener};
|
||||
use std::thread;
|
||||
use std::time::Instant;
|
||||
use tokio::sync::{mpsc, oneshot};
|
||||
use tracing::info;
|
||||
|
||||
pub struct Streamer {
|
||||
record_input: bool,
|
||||
@@ -66,8 +67,11 @@ impl Streamer {
|
||||
}
|
||||
|
||||
fn notify<S: ToString>(&self, message: S) {
|
||||
let message = message.to_string();
|
||||
info!(message);
|
||||
|
||||
self.notifier_tx
|
||||
.send(message.to_string())
|
||||
.send(message)
|
||||
.expect("notification send should succeed");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user