Make init_logging more easily usable (#6620)

Instead of requiring the `LogRotationOpt`, it now requires an
`Option<LogRotationOpt>`. This makes it much more easy to use the
interface when someone isn't interested on the `LogRotationOpt`'s
This commit is contained in:
Bastian Köcher
2020-07-09 16:47:57 +02:00
committed by GitHub
parent 234e7d0c3d
commit 5bb834cc6f
3 changed files with 78 additions and 80 deletions
+4 -4
View File
@@ -490,10 +490,10 @@ pub trait CliConfiguration: Sized {
}
/// Get the log directory for logging.
///
///
/// By default this is retrieved from `SharedParams`.
fn log_rotation_opt(&self) -> Result<&LogRotationOpt> {
Ok(self.shared_params().log_rotation_opt())
fn log_rotation_opt(&self) -> Result<LogRotationOpt> {
Ok(self.shared_params().log_rotation_opt().clone())
}
/// Initialize substrate. This must be done only once.
@@ -510,7 +510,7 @@ pub trait CliConfiguration: Sized {
sp_panic_handler::set(&C::support_url(), &C::impl_version());
fdlimit::raise_fd_limit();
init_logger(&logger_pattern, log_rotation_opt)?;
init_logger(&logger_pattern, Some(log_rotation_opt))?;
Ok(())
}