Replace logging backend to log4rs and add log rotation (#1789)

* Replace logging backend to flexi-logger and add log rotation
* Changed flexi_logger to log4rs
* Disable logging level filtering in Root logger
* Support different logging levels for file and stdout
* Don't log messages from modules other than Grin-related
* Fix formatting
* Place backed up compressed log copies into log file directory
* Increase default log file size to 16 MiB
* Add comment to config file on log_max_size option
This commit is contained in:
eupn
2018-10-21 23:30:56 +03:00
committed by Ignotus Peverell
parent 0852b0c4cf
commit 1195071f5b
83 changed files with 582 additions and 897 deletions
+4 -8
View File
@@ -30,7 +30,6 @@ use util::{kernel_sig_msg, secp};
use core::core::{Input, Output, OutputFeatures, Transaction, TxKernel};
use keychain::{self, BlindSum, BlindingFactor, Identifier, Keychain};
use libtx::{aggsig, proof};
use util::LOGGER;
/// Context information available to transaction combinators.
pub struct Context<'a, K: 'a>
@@ -67,8 +66,8 @@ where
K: Keychain,
{
debug!(
LOGGER,
"Building input (spending regular output): {}, {}", value, key_id
"Building input (spending regular output): {}, {}",
value, key_id
);
build_input(value, OutputFeatures::DEFAULT_OUTPUT, key_id)
}
@@ -78,10 +77,7 @@ pub fn coinbase_input<K>(value: u64, key_id: Identifier) -> Box<Append<K>>
where
K: Keychain,
{
debug!(
LOGGER,
"Building input (spending coinbase): {}, {}", value, key_id
);
debug!("Building input (spending coinbase): {}, {}", value, key_id);
build_input(value, OutputFeatures::COINBASE_OUTPUT, key_id)
}
@@ -95,7 +91,7 @@ where
move |build, (tx, kern, sum)| -> (Transaction, TxKernel, BlindSum) {
let commit = build.keychain.commit(value, &key_id).unwrap();
debug!(LOGGER, "Building output: {}, {:?}", value, commit);
debug!("Building output: {}, {:?}", value, commit);
let rproof = proof::create(build.keychain, value, &key_id, commit, None).unwrap();
+2 -2
View File
@@ -21,7 +21,7 @@ use core::core::KernelFeatures;
use core::core::{Output, OutputFeatures, TxKernel};
use libtx::error::Error;
use libtx::{aggsig, proof};
use util::{kernel_sig_msg, secp, static_secp_instance, LOGGER};
use util::{kernel_sig_msg, secp, static_secp_instance};
/// output a reward output
pub fn output<K>(
@@ -36,7 +36,7 @@ where
let value = reward(fees);
let commit = keychain.commit(value, key_id)?;
trace!(LOGGER, "Block reward - Pedersen Commit is: {:?}", commit,);
trace!("Block reward - Pedersen Commit is: {:?}", commit,);
let rproof = proof::create(keychain, value, key_id, commit, None)?;
+3 -3
View File
@@ -27,9 +27,9 @@ use keychain::{BlindSum, BlindingFactor, Keychain};
use libtx::error::{Error, ErrorKind};
use libtx::{aggsig, build, tx_fee};
use util::secp;
use util::secp::key::{PublicKey, SecretKey};
use util::secp::Signature;
use util::{secp, LOGGER};
/// Public data for each participant in the slate
@@ -289,7 +289,7 @@ impl Slate {
amount_to_hr_string(fee, false),
amount_to_hr_string(self.amount + self.fee, false)
);
info!(LOGGER, "{}", reason);
info!("{}", reason);
return Err(ErrorKind::Fee(reason.to_string()))?;
}
@@ -395,7 +395,7 @@ impl Slate {
final_tx.kernels_mut()[0].excess_sig = final_sig.clone();
// confirm the kernel verifies successfully before proceeding
debug!(LOGGER, "Validating final transaction");
debug!("Validating final transaction");
final_tx.kernels()[0].verify()?;
// confirm the overall transaction is valid (including the updated kernel)