Often I've used the flags like -lruntime=debug
or -lparachain=debug
without really understanding how they work. I know that the env_logger
crate allows you to specify which crates to emit log messages from like so: RUST_LOG=my_app
but what about substrate/polkadot? Does it use env_logger
or something else to enable crate level logging? Also, what significance does the string after the -l
have? Does it specify, for instance, the crate named parachain
in -lparachain=debug
?
Add a comment
|
1 Answer
-l
is essentially the same as RUST_LOG
(which we also support BTW). You can pass the following values:
- One log level (
error
,warn
,info
,debug
,trace
) that applies to all targets. - target=log level. The target is what you can specify as
target
to the logging macros or the crate name if you don't pass atarget
.
We are using tracing
for logging which is a compatible log
implementation.
-
Ah so
-l<target>
is equivalent toRUST_LOG=target
. Strange I've never seen it mentioned before in eitherlog
orenv_logger
docs. Commented Jan 28, 2023 at 16:34 -
1That is a substrate feature not any generic feature (the
-l
)– bkchr ♦Commented Jan 28, 2023 at 17:26