mirror of
https://github.com/librespot-org/librespot.git
synced 2024-12-18 17:11:53 +00:00
Replace some more println with log
This commit is contained in:
parent
e08ed545ee
commit
b0ea636179
7 changed files with 16 additions and 13 deletions
|
@ -33,8 +33,8 @@ rustc-serialize = "~0.3.16"
|
||||||
tempfile = "~2.0.0"
|
tempfile = "~2.0.0"
|
||||||
time = "~0.1.34"
|
time = "~0.1.34"
|
||||||
url = "~0.5.2"
|
url = "~0.5.2"
|
||||||
log = "0.3"
|
log = "0.3.5"
|
||||||
env_logger = "0.3"
|
env_logger = "0.3.2"
|
||||||
shannon = { git = "https://github.com/plietar/rust-shannon" }
|
shannon = { git = "https://github.com/plietar/rust-shannon" }
|
||||||
|
|
||||||
vorbis = "~0.0.14"
|
vorbis = "~0.0.14"
|
||||||
|
|
|
@ -30,7 +30,7 @@ impl <'a> Sink for PortAudioSink<'a> {
|
||||||
fn write(&self, data: &[i16]) -> io::Result<()> {
|
fn write(&self, data: &[i16]) -> io::Result<()> {
|
||||||
match self.0.write(&data) {
|
match self.0.write(&data) {
|
||||||
Ok(_) => (),
|
Ok(_) => (),
|
||||||
Err(portaudio::PaError::OutputUnderflowed) => eprintln!("Underflow"),
|
Err(portaudio::PaError::OutputUnderflowed) => error!("PortAudio write underflow"),
|
||||||
Err(e) => panic!("PA Error {}", e),
|
Err(e) => panic!("PA Error {}", e),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ pub struct PulseAudioSink(*mut pa_simple);
|
||||||
|
|
||||||
impl Open for PulseAudioSink {
|
impl Open for PulseAudioSink {
|
||||||
fn open() -> PulseAudioSink {
|
fn open() -> PulseAudioSink {
|
||||||
println!("Using PulseAudioSink");
|
info!("Using PulseAudioSink");
|
||||||
|
|
||||||
let ss = pa_sample_spec {
|
let ss = pa_sample_spec {
|
||||||
format: PA_SAMPLE_S16LE,
|
format: PA_SAMPLE_S16LE,
|
||||||
|
|
|
@ -25,7 +25,8 @@ extern crate time;
|
||||||
extern crate tempfile;
|
extern crate tempfile;
|
||||||
extern crate url;
|
extern crate url;
|
||||||
|
|
||||||
#[macro_use] extern crate log;
|
#[macro_use]
|
||||||
|
extern crate log;
|
||||||
|
|
||||||
#[cfg(not(feature = "with-tremor"))]
|
#[cfg(not(feature = "with-tremor"))]
|
||||||
extern crate vorbis;
|
extern crate vorbis;
|
||||||
|
|
|
@ -2,6 +2,8 @@ extern crate getopts;
|
||||||
extern crate librespot;
|
extern crate librespot;
|
||||||
extern crate rpassword;
|
extern crate rpassword;
|
||||||
extern crate env_logger;
|
extern crate env_logger;
|
||||||
|
#[macro_use]
|
||||||
|
extern crate log;
|
||||||
|
|
||||||
use rpassword::read_password;
|
use rpassword::read_password;
|
||||||
use std::clone::Clone;
|
use std::clone::Clone;
|
||||||
|
@ -34,12 +36,12 @@ static APPKEY: Option<&'static [u8]> = None;
|
||||||
fn main() {
|
fn main() {
|
||||||
let rust_log = "RUST_LOG";
|
let rust_log = "RUST_LOG";
|
||||||
if let Err(_) = env::var(rust_log) {
|
if let Err(_) = env::var(rust_log) {
|
||||||
env::set_var(rust_log, "info")
|
env::set_var(rust_log, "debug")
|
||||||
}
|
}
|
||||||
|
|
||||||
env_logger::init().unwrap();
|
env_logger::init().unwrap();
|
||||||
|
|
||||||
println!("librespot {} ({}). Built on {}.",
|
info!("librespot {} ({}). Built on {}.",
|
||||||
version::short_sha(),
|
version::short_sha(),
|
||||||
version::commit_date(),
|
version::commit_date(),
|
||||||
version::short_now());
|
version::short_now());
|
||||||
|
@ -150,7 +152,7 @@ fn main() {
|
||||||
}).or(stored_credentials)
|
}).or(stored_credentials)
|
||||||
.or_else(|| {
|
.or_else(|| {
|
||||||
if cfg!(feature = "discovery") {
|
if cfg!(feature = "discovery") {
|
||||||
println!("No username provided and no stored credentials, starting discovery ...");
|
info!("No username provided and no stored credentials, starting discovery ...");
|
||||||
Some(discovery_login(&session.config().device_name,
|
Some(discovery_login(&session.config().device_name,
|
||||||
session.device_id()).unwrap())
|
session.device_id()).unwrap())
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -95,7 +95,7 @@ impl Session {
|
||||||
let aps = apresolve().unwrap();
|
let aps = apresolve().unwrap();
|
||||||
let ap = thread_rng().choose(&aps).expect("No APs found");
|
let ap = thread_rng().choose(&aps).expect("No APs found");
|
||||||
|
|
||||||
println!("Connecting to AP {}", ap);
|
info!("Connecting to AP {}", ap);
|
||||||
let mut connection = PlainConnection::connect(ap).unwrap();
|
let mut connection = PlainConnection::connect(ap).unwrap();
|
||||||
|
|
||||||
let request = protobuf_init!(protocol::keyexchange::ClientHello::new(), {
|
let request = protobuf_init!(protocol::keyexchange::ClientHello::new(), {
|
||||||
|
@ -217,7 +217,7 @@ impl Session {
|
||||||
*self.0.rx_connection.lock().unwrap() = Some(connection.clone());
|
*self.0.rx_connection.lock().unwrap() = Some(connection.clone());
|
||||||
*self.0.tx_connection.lock().unwrap() = Some(connection);
|
*self.0.tx_connection.lock().unwrap() = Some(connection);
|
||||||
|
|
||||||
eprintln!("Authenticated !");
|
info!("Authenticated !");
|
||||||
|
|
||||||
let reusable_credentials = Credentials {
|
let reusable_credentials = Credentials {
|
||||||
username: username,
|
username: username,
|
||||||
|
@ -231,11 +231,11 @@ impl Session {
|
||||||
0xad => {
|
0xad => {
|
||||||
let msg: protocol::keyexchange::APLoginFailed =
|
let msg: protocol::keyexchange::APLoginFailed =
|
||||||
protobuf::parse_from_bytes(&data).unwrap();
|
protobuf::parse_from_bytes(&data).unwrap();
|
||||||
eprintln!("Authentication failed, {:?}", msg);
|
error!("Authentication failed, {:?}", msg);
|
||||||
Err(())
|
Err(())
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
println!("Unexpected message {:x}", cmd);
|
error!("Unexpected message {:x}", cmd);
|
||||||
Err(())
|
Err(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -100,7 +100,7 @@ impl SpircManager {
|
||||||
let data = pkt.payload.first().unwrap();
|
let data = pkt.payload.first().unwrap();
|
||||||
let frame = protobuf::parse_from_bytes::<protocol::spirc::Frame>(data).unwrap();
|
let frame = protobuf::parse_from_bytes::<protocol::spirc::Frame>(data).unwrap();
|
||||||
|
|
||||||
println!("{:?} {} {} {} {}",
|
debug!("{:?} {} {} {} {}",
|
||||||
frame.get_typ(),
|
frame.get_typ(),
|
||||||
frame.get_device_state().get_name(),
|
frame.get_device_state().get_name(),
|
||||||
frame.get_ident(),
|
frame.get_ident(),
|
||||||
|
|
Loading…
Reference in a new issue