|
|
@ -1,3 +1,5 @@
|
|
|
|
|
|
|
|
use std::env;
|
|
|
|
|
|
|
|
|
|
|
|
use chunk::{Chunk, OpCode};
|
|
|
|
use chunk::{Chunk, OpCode};
|
|
|
|
use vm::VM;
|
|
|
|
use vm::VM;
|
|
|
|
|
|
|
|
|
|
|
@ -10,8 +12,12 @@ mod value;
|
|
|
|
mod vm;
|
|
|
|
mod vm;
|
|
|
|
|
|
|
|
|
|
|
|
fn main() -> Result<()> {
|
|
|
|
fn main() -> Result<()> {
|
|
|
|
|
|
|
|
let level = match env::var("DEBUG") {
|
|
|
|
|
|
|
|
Ok(_) => Level::DEBUG,
|
|
|
|
|
|
|
|
Err(_) => Level::ERROR,
|
|
|
|
|
|
|
|
};
|
|
|
|
let subscriber = FmtSubscriber::builder()
|
|
|
|
let subscriber = FmtSubscriber::builder()
|
|
|
|
.with_max_level(Level::DEBUG)
|
|
|
|
.with_max_level(level)
|
|
|
|
.finish();
|
|
|
|
.finish();
|
|
|
|
tracing::subscriber::set_global_default(subscriber)
|
|
|
|
tracing::subscriber::set_global_default(subscriber)
|
|
|
|
.wrap_err("setting default subscriber failed")?;
|
|
|
|
.wrap_err("setting default subscriber failed")?;
|
|
|
|