More renaming
This commit is contained in:
@@ -30,7 +30,7 @@ To build `synapse_auto_compressor`, clone this repository and navigate to the
|
|||||||
`synapse_auto_compressor/` subdirectory. Then execute `cargo build`.
|
`synapse_auto_compressor/` subdirectory. Then execute `cargo build`.
|
||||||
|
|
||||||
This will create an executable and store it in
|
This will create an executable and store it in
|
||||||
`synapse_auto_compressor/target/debug/auto_compressor`.
|
`synapse_auto_compressor/target/debug/synapse_auto_compressor`.
|
||||||
|
|
||||||
## Example usage
|
## Example usage
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -356,7 +356,7 @@ fn functions_are_self_consistent() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn setup_logger() {
|
pub fn setup_logger() {
|
||||||
// setup the logger for the auto_compressor
|
// setup the logger for the synapse_auto_compressor
|
||||||
// The default can be overwritten with RUST_LOG
|
// The default can be overwritten with RUST_LOG
|
||||||
// see the README for more information
|
// see the README for more information
|
||||||
if env::var("RUST_LOG").is_err() {
|
if env::var("RUST_LOG").is_err() {
|
||||||
@@ -366,7 +366,7 @@ pub fn setup_logger() {
|
|||||||
// default to printing the debug information for both packages being tested
|
// default to printing the debug information for both packages being tested
|
||||||
// (Note that just setting the global level to debug will log every sql transaction)
|
// (Note that just setting the global level to debug will log every sql transaction)
|
||||||
log_builder.filter_module("synapse_compress_state", LevelFilter::Debug);
|
log_builder.filter_module("synapse_compress_state", LevelFilter::Debug);
|
||||||
log_builder.filter_module("auto_compressor", LevelFilter::Debug);
|
log_builder.filter_module("synapse_auto_compressor", LevelFilter::Debug);
|
||||||
// use try_init() incase the logger has been setup by some previous test
|
// use try_init() incase the logger has been setup by some previous test
|
||||||
let _ = log_builder.try_init();
|
let _ = log_builder.try_init();
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -61,11 +61,12 @@ fn synapse_auto_compressor(_py: Python, m: &PyModule) -> PyResult<()> {
|
|||||||
let _ = pyo3_log::Logger::default()
|
let _ = pyo3_log::Logger::default()
|
||||||
// don't send out anything lower than a warning from other crates
|
// don't send out anything lower than a warning from other crates
|
||||||
.filter(LevelFilter::Warn)
|
.filter(LevelFilter::Warn)
|
||||||
// don't log warnings from synapse_compress_state, the auto_compressor handles these
|
// don't log warnings from synapse_compress_state, the
|
||||||
// situations and provides better log messages
|
// synapse_auto_compressor handles these situations and provides better
|
||||||
|
// log messages
|
||||||
.filter_target("synapse_compress_state".to_owned(), LevelFilter::Error)
|
.filter_target("synapse_compress_state".to_owned(), LevelFilter::Error)
|
||||||
// log info and above for the auto_compressor
|
// log info and above for the synapse_auto_compressor
|
||||||
.filter_target("auto_compressor".to_owned(), LevelFilter::Debug)
|
.filter_target("synapse_auto_compressor".to_owned(), LevelFilter::Debug)
|
||||||
.install();
|
.install();
|
||||||
// ensure any panics produce error messages in the log
|
// ensure any panics produce error messages in the log
|
||||||
log_panics::init();
|
log_panics::init();
|
||||||
@@ -92,7 +93,7 @@ fn synapse_auto_compressor(_py: Python, m: &PyModule) -> PyResult<()> {
|
|||||||
number_of_chunks: i64,
|
number_of_chunks: i64,
|
||||||
) -> PyResult<()> {
|
) -> PyResult<()> {
|
||||||
// Announce the start of the program to the logs
|
// Announce the start of the program to the logs
|
||||||
log::info!("auto_compressor started");
|
log::info!("synapse_auto_compressor started");
|
||||||
|
|
||||||
// Parse the default_level string into a LevelInfo struct
|
// Parse the default_level string into a LevelInfo struct
|
||||||
let default_levels: LevelInfo = match default_levels.parse() {
|
let default_levels: LevelInfo = match default_levels.parse() {
|
||||||
@@ -120,7 +121,7 @@ fn synapse_auto_compressor(_py: Python, m: &PyModule) -> PyResult<()> {
|
|||||||
return Err(PyErr::new::<PyRuntimeError, _>(format!("{:?}", e)));
|
return Err(PyErr::new::<PyRuntimeError, _>(format!("{:?}", e)));
|
||||||
}
|
}
|
||||||
|
|
||||||
log::info!("auto_compressor finished");
|
log::info!("synapse_auto_compressor finished");
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|||||||
@@ -26,13 +26,13 @@ use synapse_auto_compressor::{manager, state_saving, LevelInfo};
|
|||||||
|
|
||||||
/// Execution starts here
|
/// Execution starts here
|
||||||
fn main() {
|
fn main() {
|
||||||
// setup the logger for the auto_compressor
|
// setup the logger for the synapse_auto_compressor
|
||||||
// The default can be overwritten with RUST_LOG
|
// The default can be overwritten with RUST_LOG
|
||||||
// see the README for more information
|
// see the README for more information
|
||||||
let log_file = OpenOptions::new()
|
let log_file = OpenOptions::new()
|
||||||
.append(true)
|
.append(true)
|
||||||
.create(true)
|
.create(true)
|
||||||
.open("auto_compressor.log")
|
.open("synapse_auto_compressor.log")
|
||||||
.unwrap_or_else(|e| panic!("Error occured while opening the log file: {}", e));
|
.unwrap_or_else(|e| panic!("Error occured while opening the log file: {}", e));
|
||||||
|
|
||||||
if env::var("RUST_LOG").is_err() {
|
if env::var("RUST_LOG").is_err() {
|
||||||
@@ -41,8 +41,8 @@ fn main() {
|
|||||||
log_builder.filter_module("panic", LevelFilter::Error);
|
log_builder.filter_module("panic", LevelFilter::Error);
|
||||||
// Only output errors from the synapse_compress state library
|
// Only output errors from the synapse_compress state library
|
||||||
log_builder.filter_module("synapse_compress_state", LevelFilter::Error);
|
log_builder.filter_module("synapse_compress_state", LevelFilter::Error);
|
||||||
// Output log levels info and above from auto_compressor
|
// Output log levels info and above from synapse_auto_compressor
|
||||||
log_builder.filter_module("auto_compressor", LevelFilter::Info);
|
log_builder.filter_module("synapse_auto_compressor", LevelFilter::Info);
|
||||||
log_builder.init();
|
log_builder.init();
|
||||||
} else {
|
} else {
|
||||||
// If RUST_LOG was set then use that
|
// If RUST_LOG was set then use that
|
||||||
@@ -54,7 +54,7 @@ fn main() {
|
|||||||
}
|
}
|
||||||
log_panics::init();
|
log_panics::init();
|
||||||
// Announce the start of the program to the logs
|
// Announce the start of the program to the logs
|
||||||
log::info!("auto_compressor started");
|
log::info!("synapse_auto_compressor started");
|
||||||
|
|
||||||
// parse the command line arguments using the clap crate
|
// parse the command line arguments using the clap crate
|
||||||
let arguments = App::new(crate_name!())
|
let arguments = App::new(crate_name!())
|
||||||
@@ -155,5 +155,5 @@ fn main() {
|
|||||||
manager::compress_chunks_of_database(db_url, chunk_size, &default_levels.0, number_of_chunks)
|
manager::compress_chunks_of_database(db_url, chunk_size, &default_levels.0, number_of_chunks)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
log::info!("auto_compressor finished");
|
log::info!("synapse_auto_compressor finished");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user