mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-31 13:21:01 +00:00
Match substrate's fmt (#1148)
* Alter gitlab. * Use substrate's rustfmt.toml * cargo +nightly fmt --all * Fix spellcheck. * cargo +nightly fmt --all * format. * Fix spellcheck and fmt * fmt? * Fix spellcheck Co-authored-by: Tomasz Drwięga <tomasz@parity.io>
This commit is contained in:
@@ -62,14 +62,7 @@ pub fn initialize_logger(with_timestamp: bool) {
|
||||
let log_level = color_level(record.level());
|
||||
let log_target = color_target(record.target());
|
||||
|
||||
writeln!(
|
||||
buf,
|
||||
"{}{} {} {}",
|
||||
loop_name_prefix(),
|
||||
log_level,
|
||||
log_target,
|
||||
record.args(),
|
||||
)
|
||||
writeln!(buf, "{}{} {} {}", loop_name_prefix(), log_level, log_target, record.args(),)
|
||||
});
|
||||
}
|
||||
|
||||
@@ -81,12 +74,14 @@ pub(crate) fn initialize_loop(loop_name: String) {
|
||||
LOOP_NAME.with(|g_loop_name| *g_loop_name.borrow_mut() = loop_name);
|
||||
}
|
||||
|
||||
/// Returns loop name prefix to use in logs. The prefix is initialized with the `initialize_loop` call.
|
||||
/// Returns loop name prefix to use in logs. The prefix is initialized with the `initialize_loop`
|
||||
/// call.
|
||||
fn loop_name_prefix() -> String {
|
||||
// try_with to avoid panic outside of async-std task context
|
||||
LOOP_NAME
|
||||
.try_with(|loop_name| {
|
||||
// using borrow is ok here, because loop is only initialized once (=> borrow_mut will only be called once)
|
||||
// using borrow is ok here, because loop is only initialized once (=> borrow_mut will
|
||||
// only be called once)
|
||||
let loop_name = loop_name.borrow();
|
||||
if loop_name.is_empty() {
|
||||
String::new()
|
||||
|
||||
Reference in New Issue
Block a user