Do debug output when creating a file object

This commit is contained in:
Matthias Beyer 2015-11-27 19:37:20 +01:00
parent c82f9ea6ae
commit 20dc562dee

View file

@ -185,43 +185,53 @@ pub struct File {
impl File { impl File {
pub fn new() -> File { pub fn new() -> File {
File { let f = File {
header: FileHeaderData::Null, header: FileHeaderData::Null,
data: String::from(""), data: String::from(""),
id: File::get_new_file_id(), id: File::get_new_file_id(),
} };
debug!("Create new File object: {:?}", f);
f
} }
pub fn from_parser_result(id: FileID, header: FileHeaderData, data: String) -> File { pub fn from_parser_result(id: FileID, header: FileHeaderData, data: String) -> File {
File { let f = File {
header: header, header: header,
data: data, data: data,
id: id, id: id,
} };
debug!("Create new File object from parser result: {:?}", f);
f
} }
pub fn new_with_header(h: FileHeaderData) -> File { pub fn new_with_header(h: FileHeaderData) -> File {
File { let f = File {
header: h, header: h,
data: String::from(""), data: String::from(""),
id: File::get_new_file_id(), id: File::get_new_file_id(),
} };
debug!("Create new File object with header: {:?}", f);
f
} }
pub fn new_with_data(d: String) -> File { pub fn new_with_data(d: String) -> File {
File { let f = File {
header: FileHeaderData::Null, header: FileHeaderData::Null,
data: d, data: d,
id: File::get_new_file_id(), id: File::get_new_file_id(),
} };
debug!("Create new File object with data: {:?}", f);
f
} }
pub fn new_with_content(h: FileHeaderData, d: String) -> File { pub fn new_with_content(h: FileHeaderData, d: String) -> File {
File { let f = File {
header: h, header: h,
data: d, data: d,
id: File::get_new_file_id(), id: File::get_new_file_id(),
} };
debug!("Create new File object with content: {:?}", f);
f
} }
pub fn contents(&self) -> (FileHeaderData, String) { pub fn contents(&self) -> (FileHeaderData, String) {