robyoung/tplinker

Help supressing log messages of results.

louisjrdev opened this issue · 2 comments

Is it possible to suppress the printing to the console as seen here:

println!("RESULT: {}", result);

I have a basic console app and these messages are being printed to the console, cluttering the output. Is there a way to suppress them from logging to the console?

An example tp generate this issue is:

use tplinker::{
    discovery::discover,
    devices::Device,
    capabilities::Switch,
};
use tplinker::capabilities::DeviceActions;

fn main() {
    for (addr, data) in discover().unwrap() {
        let device = Device::from_data(addr, &data);
        let sysinfo = data.sysinfo();
        println!("{}\t{}\t{}", addr, sysinfo.alias, sysinfo.hw_type);
        println!("{}", device.alias().unwrap()); // This is where we get the line printed to the console, when i call device.alias()
    }
}

Sorry that was a mistake. If you update to 0.4.3 it should no longer happen.

@robyoung Great thanks! Appreciate your work on this library by the way, might have a PR on the way soon for some additional device support.