Logger
In development, logs are a common debugging tool. This chapter introduces the logging functionality of CKB Script.
note
Even if the output is not captured, the logging
still consumes cycles.
debug!
Output a debug message.
This macro only compiled under debug build and does nothing in release build. To debug the release build, include -C debug-assertions
in the environment variable RUSTFLAGS
before calling cargo build
.
note
In ckb-script-templates
, debug-assertions
is enabled by default. To disable it, comment out the line CUSTOM_RUSTFLAGS := -C debug-assertions
in the contract's Makefile
.
Syntax
macro_rules! debug {
($fmt:literal) => { ... }
($fmt:literal, $($args:expr),+) => { ... }
Parameters
fmt
: Format control.args
: Optional arguments.
Return
None