Paniclog Method
The paniclog method returns persisted panic records as a structured array. Each record contains bounded diagnostic context and VM state. Avoid placing sensitive values in the diagnostic context.
Using TypeScript
For TypeScript, call .paniclog() on a VM configured with the Debug capability. The method returns the records array and throws an error if the records cannot be retrieved or parsed.
ts
import { Capability, LightVM } from 'lightvm';
const vm = new LightVM({ caps: [Capability.Debug] });
const records = vm.paniclog();
console.log(records);Using Rust
In Rust, call .paniclog() on a VM configured with the Debug capability. The method returns Result<serde_json::Value, VMError>, where the JSON value is an array of panic records.
rust
use lightvm::LightVM;
use lightvm::types::{capability::Capability, vmconfig::VmConfig};
fn main() -> Result<(), Box<dyn std::error::Error>> {
let vm = LightVM::new(VmConfig {
caps: vec![Capability::Debug],
..Default::default()
});
let records = vm.paniclog()?;
println!("{records}");
Ok(())
}INFO
Capability Required: Debug
WARNING
The .paniclog() method is unavailable in WebAssembly builds.