diff --git a/frontmatter.odin b/frontmatter.odin index 731320a..1a5f4d8 100644 --- a/frontmatter.odin +++ b/frontmatter.odin @@ -1,7 +1,7 @@ package main import "core:encoding/json" -import "core:fmt" +import "core:log" import "core:strings" Frontmatter :: struct { @@ -38,7 +38,7 @@ parse_frontmatter :: proc(content: string) -> (fm: Frontmatter, body: string, ok value, err := json.parse_string(json_str, spec = .JSON) if err != nil { - fmt.eprintfln("failed to parse frontmatter JSON: %v", err) + log.errorf("failed to parse frontmatter JSON: %v", err) return } defer json.destroy_value(value) diff --git a/main.odin b/main.odin index b39dc9c..0dd7ce8 100644 --- a/main.odin +++ b/main.odin @@ -20,7 +20,7 @@ main :: proc() { when SPALL { ctx, ok := spall.context_create_with_scale("thor.spall", false, 1.0) if !ok { - fmt.eprintln("Failed to create spall trace file") + log.fatal("Failed to create spall trace file") os.exit(1) } spall_ctx = ctx diff --git a/render.odin b/render.odin index 8aaefd1..6bad63a 100644 --- a/render.odin +++ b/render.odin @@ -397,7 +397,7 @@ write_page :: proc(output_dir: string, permalink: string, html: string) { dir := fmt.tprintf("%s/%s", output_dir, rel) if err := os.make_directory_all(dir); err != nil && err != .Exist { - fmt.eprintfln("cannot create %s: %v", dir, err) + log.errorf("cannot create %s: %v", dir, err) return } @@ -407,7 +407,7 @@ write_page :: proc(output_dir: string, permalink: string, html: string) { write_file :: proc(path: string, html: string) { if err := os.write_entire_file_from_string(path, html); err != nil { - fmt.eprintfln("cannot write %s: %v", path, err) + log.errorf("cannot write %s: %v", path, err) } }