mirror of
https://github.com/kata-containers/cgroups-rs.git
synced 2026-08-05 02:13:23 +00:00
Replace println! calls with logging
This commit is contained in:
committed by
Levente Kurusa
parent
adc3323be4
commit
84ae587360
@@ -265,7 +265,7 @@ impl DevicesController {
|
||||
s.lines().fold(Ok(Vec::new()), |acc, line| {
|
||||
let ls = line.to_string().split(|c| c == ' ' || c == ':').map(|x| x.to_string()).collect::<Vec<String>>();
|
||||
if acc.is_err() || ls.len() != 4 {
|
||||
println!("line 204: acc: {:?}, ls: {:?}", acc, ls);
|
||||
error!("allowed_devices: acc: {:?}, ls: {:?}", acc, ls);
|
||||
Err(CgroupError::ParseError)
|
||||
} else {
|
||||
let devtype = DeviceType::from_char(ls[0].chars().nth(0));
|
||||
@@ -278,7 +278,7 @@ impl DevicesController {
|
||||
minor = Ok(-1);
|
||||
}
|
||||
if devtype.is_none() || major.is_err() || minor.is_err() || !DevicePermissions::is_valid(&ls[3]) {
|
||||
println!("line 211: acc: {:?}, ls: {:?}, devtype: {:?}, major {:?} minor {:?} ls3 {:?}",
|
||||
error!("allowed_devices: acc: {:?}, ls: {:?}, devtype: {:?}, major {:?} minor {:?} ls3 {:?}",
|
||||
acc, ls, devtype, major, minor, &ls[3]);
|
||||
Err(CgroupError::ParseError)
|
||||
} else {
|
||||
|
||||
@@ -127,7 +127,7 @@ fn find_v1_mount() -> Option<String> {
|
||||
let fstype = more_fields[0];
|
||||
if fstype == "tmpfs" && more_fields[2].contains("ro") {
|
||||
let cgroups_mount = fields.nth(4).unwrap();
|
||||
println!("found cgroups at {:?}", cgroups_mount);
|
||||
info!("found cgroups at {:?}", cgroups_mount);
|
||||
return Some(cgroups_mount.to_string());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
#[macro_use]
|
||||
extern crate log;
|
||||
|
||||
use std::fs::File;
|
||||
use std::io::{BufRead, BufReader, Write};
|
||||
use std::path::PathBuf;
|
||||
@@ -163,7 +166,7 @@ pub trait Controller {
|
||||
if self.verify_path() {
|
||||
match ::std::fs::create_dir(self.get_path()) {
|
||||
Ok(_) => (),
|
||||
Err(e) => println!("error create_dir {:?}", e),
|
||||
Err(e) => warn!("error create_dir {:?}", e),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user