Skip to content

Commit de994cf

Browse files
committed
fixes
1 parent 00c3bfa commit de994cf

File tree

5 files changed

+10
-14
lines changed

5 files changed

+10
-14
lines changed

Cargo.lock

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

substrate/client/tracing/proc-macro/Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ targets = ["x86_64-unknown-linux-gnu"]
1818
proc-macro = true
1919

2020
[dependencies]
21+
frame-support-procedural-tools = { workspace = true, default-features = true }
2122
proc-macro-crate = { workspace = true }
2223
proc-macro2 = { workspace = true }
2324
quote = { features = ["proc-macro"], workspace = true }

substrate/client/tracing/proc-macro/src/lib.rs

+6-11
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@
1515
// See the License for the specific language governing permissions and
1616
// limitations under the License.
1717

18+
use frame_support_procedural_tools::generate_access_from_frame_or_crate;
1819
use proc_macro::TokenStream;
1920
use proc_macro2::Span;
20-
use proc_macro_crate::{crate_name, FoundCrate};
2121
use quote::quote;
22-
use syn::{Error, Expr, Ident, ItemFn};
22+
use syn::{Error, Expr, ItemFn};
2323

2424
/// Add a log prefix to the function.
2525
///
@@ -109,22 +109,17 @@ pub fn prefix_logs_with(arg: TokenStream, item: TokenStream) -> TokenStream {
109109
if arg.is_empty() {
110110
return Error::new(
111111
Span::call_site(),
112-
"missing argument: name of the node. Example: #[prefix_logs_with(\"MyNode\")]",
112+
"missing argument: prefix. Example: sc_cli::prefix_logs_with(<expr>)",
113113
)
114114
.to_compile_error()
115115
.into();
116116
}
117117

118118
let name = syn::parse_macro_input!(arg as Expr);
119119

120-
let crate_name = match crate_name("polkadot-sdk") {
121-
Ok(FoundCrate::Name(sdk_name)) => Ident::new(sdk_name.as_str(), Span::call_site()),
122-
_ => match crate_name("sc-tracing") {
123-
Ok(FoundCrate::Itself) => Ident::new("sc_tracing", Span::call_site()),
124-
Ok(FoundCrate::Name(tracing_name)) =>
125-
Ident::new(tracing_name.as_str(), Span::call_site()),
126-
Err(e) => return Error::new(Span::call_site(), e).to_compile_error().into(),
127-
},
120+
let crate_name = match generate_access_from_frame_or_crate("sc-tracing") {
121+
Ok(ident) => ident,
122+
Err(err) => return err.to_compile_error().into(),
128123
};
129124

130125
let ItemFn { attrs, vis, sig, block } = item_fn;

templates/parachain/node/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ parachain-template-runtime = { workspace = true }
2626
prometheus-endpoint = { workspace = true, default-features = true }
2727

2828
[build-dependencies]
29-
polkadot-sdk = { workspace = true, features = ["node", "substrate-build-script-utils"] }
29+
polkadot-sdk = { workspace = true, features = ["substrate-build-script-utils"] }
3030

3131
[features]
3232
default = ["std"]

templates/parachain/node/src/service.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ use cumulus_relay_chain_interface::{OverseerHandle, RelayChainInterface};
3131

3232
// Substrate Imports
3333
use frame_benchmarking_cli::SUBSTRATE_REFERENCE_HARDWARE;
34-
use polkadot_sdk::sc_tracing::logging;
3534
use prometheus_endpoint::Registry;
3635
use sc_client_api::Backend;
3736
use sc_consensus::ImportQueue;
@@ -229,7 +228,7 @@ fn start_consensus(
229228
}
230229

231230
/// Start a node with the given parachain `Configuration` and relay chain `Configuration`.
232-
#[logging::prefix_logs_with("Parachain")]
231+
#[sc_tracing::logging::prefix_logs_with("Parachain")]
233232
pub async fn start_parachain_node(
234233
parachain_config: Configuration,
235234
polkadot_config: Configuration,

0 commit comments

Comments
 (0)