-
Notifications
You must be signed in to change notification settings - Fork 1.7k
prevent silent errors in daemon mode #10007
Changes from all commits
d53b9e9
37fd2c8
c8c71d9
392dafb
6311b2c
1bde838
4291552
8a7e262
def13ad
6245d50
bbdaf66
a0752e1
574805c
ef856ef
1efbb72
c93e31c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -111,19 +111,22 @@ mod user_defaults; | |
mod whisper; | ||
mod db; | ||
|
||
use std::io::BufReader; | ||
use std::fs::File; | ||
use hash::keccak_buffer; | ||
use std::io::BufReader; | ||
use std::sync::Arc; | ||
|
||
use cli::Args; | ||
use configuration::{Cmd, Execute}; | ||
use deprecated::find_deprecated; | ||
use ethcore_logger::setup_log; | ||
use hash::keccak_buffer; | ||
|
||
#[cfg(feature = "memory_profiling")] | ||
use std::alloc::System; | ||
|
||
pub use self::configuration::Configuration; | ||
pub use self::run::RunningClient; | ||
pub use parity_rpc::PubSubSession; | ||
pub use ethcore_logger::{Config as LoggerConfig, setup_log, RotatingLogger}; | ||
|
||
#[cfg(feature = "memory_profiling")] | ||
#[global_allocator] | ||
|
@@ -180,14 +183,13 @@ pub enum ExecutionAction { | |
Running(RunningClient), | ||
} | ||
|
||
fn execute<Cr, Rr>(command: Execute, on_client_rq: Cr, on_updater_rq: Rr) -> Result<ExecutionAction, String> | ||
fn execute<Cr, Rr>( | ||
command: Execute, | ||
logger: Arc<RotatingLogger>, | ||
on_client_rq: Cr, on_updater_rq: Rr) -> Result<ExecutionAction, String> | ||
where Cr: Fn(String) + 'static + Send, | ||
Rr: Fn() + 'static + Send | ||
{ | ||
// TODO: move this to `main()` and expose in the C API so that users can setup logging the way | ||
// they want | ||
let logger = setup_log(&command.logger).expect("Logger is initialized only once; qed"); | ||
|
||
#[cfg(feature = "deadlock_detection")] | ||
run_deadlock_detection_thread(); | ||
|
||
|
@@ -221,14 +223,21 @@ fn execute<Cr, Rr>(command: Execute, on_client_rq: Cr, on_updater_rq: Rr) -> Res | |
/// binary. | ||
/// | ||
/// On error, returns what to print on stderr. | ||
pub fn start<Cr, Rr>(conf: Configuration, on_client_rq: Cr, on_updater_rq: Rr) -> Result<ExecutionAction, String> | ||
where Cr: Fn(String) + 'static + Send, | ||
Rr: Fn() + 'static + Send | ||
// FIXME: totally independent logging capability, see https://github.com/paritytech/parity-ethereum/issues/10252 | ||
pub fn start<Cr, Rr>( | ||
conf: Configuration, | ||
logger: Arc<RotatingLogger>, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This breaks the C-bindings in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The difficult part of #8574 (and the reason why it wasn't done immediately when However I guess we can ignore the problem in the name of "meh, who cares", and open another issue for that specific thing instead. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We're not exposing There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I mentioned "when parity-clib was created", because the Rust lib and the C library were created at the same time. The logging system is unfortunately a global variable, and thus it shouldn't be the job of a library to set it. |
||
on_client_rq: Cr, | ||
on_updater_rq: Rr | ||
) -> Result<ExecutionAction, String> | ||
where | ||
Cr: Fn(String) + 'static + Send, | ||
Rr: Fn() + 'static + Send | ||
{ | ||
let deprecated = find_deprecated(&conf.args); | ||
for d in deprecated { | ||
println!("{}", d); | ||
} | ||
|
||
execute(conf.into_command()?, on_client_rq, on_updater_rq) | ||
execute(conf.into_command()?, logger, on_client_rq, on_updater_rq) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed these printouts doesn't make sense anymore when these can be controlled via the
logger