aboutsummaryrefslogtreecommitdiffstats
path: root/src/playlist.rs
diff options
context:
space:
mode:
authorJokler <jokler@protonmail.com>2020-10-14 00:19:27 +0200
committerJokler <jokler@protonmail.com>2020-10-15 01:45:29 +0200
commit4e1c2b9f04073294ecb8402486c20d9c01721598 (patch)
tree93fe1d75477ae3d1c8466611a2cedd7bed316aa2 /src/playlist.rs
parent23671b51b4e207574a63bce820acbf43169e2b6c (diff)
downloadpokebot-4e1c2b9f04073294ecb8402486c20d9c01721598.tar.gz
pokebot-4e1c2b9f04073294ecb8402486c20d9c01721598.zip
Replace channels&locks with actors & log with slog
Diffstat (limited to 'src/playlist.rs')
-rw-r--r--src/playlist.rs16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/playlist.rs b/src/playlist.rs
index 445f8a5..31fcfc0 100644
--- a/src/playlist.rs
+++ b/src/playlist.rs
@@ -1,29 +1,35 @@
use std::collections::VecDeque;
-use log::info;
+use slog::{info, Logger};
use crate::youtube_dl::AudioMetadata;
pub struct Playlist {
data: VecDeque<AudioMetadata>,
+ logger: Logger,
}
impl Playlist {
- pub fn new() -> Self {
+ pub fn new(logger: Logger) -> Self {
Self {
data: VecDeque::new(),
+ logger,
}
}
pub fn push(&mut self, data: AudioMetadata) {
- info!("Adding {:?} to playlist", &data.title);
+ info!(self.logger, "Adding to playlist"; "title" => &data.title);
self.data.push_front(data)
}
pub fn pop(&mut self) -> Option<AudioMetadata> {
let res = self.data.pop_back();
- info!("Popping {:?} from playlist", res.as_ref().map(|r| &r.title));
+ info!(
+ self.logger,
+ "Popping from playlist";
+ "title" => res.as_ref().map(|r| &r.title)
+ );
res
}
@@ -45,6 +51,6 @@ impl Playlist {
pub fn clear(&mut self) {
self.data.clear();
- info!("Cleared playlist")
+ info!(self.logger, "Cleared playlist")
}
}