(source: https://hackmd.io/@polkadot/jip1 from 2024-12-09)
JIP-1: Debug message host call
A host call for passing a debugging message from the service/authorizer to the hosting environment for logging to the node operator.
Host-call specification
Index: 100
Name: log
Input registers:
Output registers:
level
=target
=message
=
Side-effects
No side-effects if memory access is invalid.
Otherwise, express a message to user according to the user-agent.
Suggestions & examples
Levels definition
- 0: User agent displays as fatal error ⛔️
- 1: User agent displays as warning ⚠️
- 2: User agent displays as important information ℹ️
- 3: User agent displays as helpful information 💁
- 4: User agent displays as pedantic information 🪡
Display format for console logging
Note that <CORE>
is assumed to be the integer index of the core on which the PVM is executing, which may not exist (e.g. in the On-Transfer logic).
Note that <SERVICE_ID>
is assumed to be the integer index of the service for which the PVM is executing, which may not exist (e.g. in the Is-Authorized logic).
<YYYY-MM-DD hh-mm-ss> <LEVEL>[@<CORE>]?[#<SERVICE_ID>]? [<TARGET>]? <MESSAGE>
Example log item
2025/01/01 12:10:42 DEBUG@1#42 bootstrap-refine Hello world!
Format for JSON logging
{
"time": "<YYYY-MM-DD hh-mm-ss>",
"level": "<LEVEL>",
"message": "<MESSAGE>",
"target": "<TARGET>" | null
"service": "<SERVICE_ID>" | null
"core": "<CORE>" | null
}