From c8124ed3881ed01e578910c509ee8e5056b824ce Mon Sep 17 00:00:00 2001 From: Tangent Wantwight Date: Wed, 9 Sep 2020 21:57:33 -0400 Subject: [PATCH] Add INFO logging for channel creation/garbage-collection --- CHANGELOG.md | 1 + src/channel.rs | 7 +++++++ src/lib.rs | 1 + 3 files changed, 9 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index f590dc6..2228370 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ ## v0.3.1-dev - forget a channel's initialization segment when no transmitter is active. This improves behavior when a channel is occasionally used for streams with different codecs. +- Add INFO logging for channel creation/garbage-collection ## v0.3.0 - update internals to v0.2 of `warp` and `tokio`; no remaining code relies on `futures` 0.1 diff --git a/src/channel.rs b/src/channel.rs index d72c65f..8c05b85 100644 --- a/src/channel.rs +++ b/src/channel.rs @@ -25,6 +25,7 @@ pub type Handle = Arc>; impl Channel { pub fn new(name: String) -> Handle { + info!("Opening Channel {}", name); Arc::new(Mutex::new(Channel { name, header_chunk: None, @@ -33,6 +34,12 @@ impl Channel { } } +impl Drop for Channel { + fn drop(&mut self) { + info!("Closing Channel {}", self.name); + } +} + pub struct Transmitter { channel: Handle, } diff --git a/src/lib.rs b/src/lib.rs index c629cfd..dd3f347 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,3 +1,4 @@ +#[macro_use] extern crate log; pub mod ebml; pub mod error;