Use log crate rather than println

This commit is contained in:
Patrick Lühne 2020-05-05 19:43:41 +02:00
parent dd208ffeeb
commit 75e97a5c07
Signed by: patrick
GPG Key ID: 05F3611E97A70ABF
3 changed files with 12 additions and 9 deletions

View File

@ -11,3 +11,6 @@ keywords = ["logic"]
categories = ["data-structures", "science"] categories = ["data-structures", "science"]
license = "MIT" license = "MIT"
edition = "2018" edition = "2018"
[dependencies]
log = "0.4"

View File

@ -195,7 +195,7 @@ where
let indentation = " ".repeat(level); let indentation = " ".repeat(level);
let input = self.input.trim_start(); let input = self.input.trim_start();
println!("{}- parsing formula: {}", indentation, input); log::trace!("{}- parsing formula: {}", indentation, input);
match input.chars().next() match input.chars().next()
{ {
@ -209,7 +209,7 @@ where
// Parse logical infix connectives // Parse logical infix connectives
if let Some(top_level_logical_connective) = self.top_level_logical_connective()? if let Some(top_level_logical_connective) = self.top_level_logical_connective()?
{ {
println!("{} parsing “{:?}” logical connective", indentation, log::trace!("{} parsing “{:?}” logical connective", indentation,
top_level_logical_connective); top_level_logical_connective);
// Parse arguments of n-ary logical infix connectives // Parse arguments of n-ary logical infix connectives
@ -260,7 +260,7 @@ where
"not" => "not" =>
{ {
let input = input.trim_start(); let input = input.trim_start();
println!("{} parsing “not” formula body: {}", indentation, input); log::trace!("{} parsing “not” formula body: {}", indentation, input);
let argument = FormulaStr::new(input, self.declarations, self.variable_declaration_stack).parse(level + 1)?; let argument = FormulaStr::new(input, self.declarations, self.variable_declaration_stack).parse(level + 1)?;
@ -299,7 +299,7 @@ where
if let Some(quantifier) = quantifier if let Some(quantifier) = quantifier
{ {
let input = input.trim_start(); let input = input.trim_start();
println!("{} parsing “{:?}” formula body: {}", indentation, quantifier, input); log::trace!("{} parsing “{:?}” formula body: {}", indentation, quantifier, input);
return self.quantified_formula(input, quantifier, level + 1); return self.quantified_formula(input, quantifier, level + 1);
} }
@ -322,7 +322,7 @@ where
crate::parse::error::Location::new(0, Some(0)))); crate::parse::error::Location::new(0, Some(0))));
} }
println!("{} parsing “{:?}” comparison: {}", indentation, comparison_operator, input); log::trace!("{} parsing “{:?}” comparison: {}", indentation, comparison_operator, input);
let mut comparison_operator_split = self.comparison_operators().split(); let mut comparison_operator_split = self.comparison_operators().split();
@ -346,7 +346,7 @@ where
// Parse predicates // Parse predicates
if let Some((predicate_name, input)) = predicate_name(input) if let Some((predicate_name, input)) = predicate_name(input)
{ {
println!("{} parsing predicate {}", indentation, predicate_name); log::trace!("{} parsing predicate {}", indentation, predicate_name);
let input = input.trim_start(); let input = input.trim_start();

View File

@ -302,7 +302,7 @@ where
pub fn parse(&self, level: usize) -> Result<crate::Term, crate::parse::Error> pub fn parse(&self, level: usize) -> Result<crate::Term, crate::parse::Error>
{ {
let indentation = " ".repeat(level); let indentation = " ".repeat(level);
println!("{}- parsing term: {}", indentation, self.input); log::trace!("{}- parsing term: {}", indentation, self.input);
let input = self.input.trim_start(); let input = self.input.trim_start();
@ -321,7 +321,7 @@ where
if let Some(top_level_arithmetic_operator_class) = if let Some(top_level_arithmetic_operator_class) =
self.top_level_arithmetic_operator_class()? self.top_level_arithmetic_operator_class()?
{ {
println!("{} parsing {:?} arithmetic term", indentation, log::trace!("{} parsing {:?} arithmetic term", indentation,
top_level_arithmetic_operator_class); top_level_arithmetic_operator_class);
if top_level_arithmetic_operator_class == ArithmeticOperatorClass::Exponential if top_level_arithmetic_operator_class == ArithmeticOperatorClass::Exponential
@ -440,7 +440,7 @@ where
_ if is_function_name(identifier) => _ if is_function_name(identifier) =>
{ {
let function_name = identifier; let function_name = identifier;
println!("{} parsing function {}", indentation, function_name); log::trace!("{} parsing function {}", indentation, function_name);
let input = input.trim_start(); let input = input.trim_start();