Skip to content

Commit

Permalink
feat: Ensure log directory exists before creating log database
Browse files Browse the repository at this point in the history
  • Loading branch information
lifegpc committed Jan 6, 2025
1 parent 32e861e commit 62dda6b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion utils/logger.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { join } from "@std/path";
import { format as format_ver, parse as parse_ver } from "@std/semver";
import type { Config } from "../config.ts";
import { parse_bool, stackTrace } from "../utils.ts";
import { parse_bool, stackTrace, sure_dir_sync } from "../utils.ts";
import { Db, QueryParameterSet, SqliteMaster } from "./db_interface.ts";

const ALL_TABLES = [
Expand Down Expand Up @@ -78,6 +78,7 @@ class BaseLogger extends EventTarget {
this.#cfg = cfg;
const base_path = cfg.db_path || cfg.base;
const db_path = join(base_path, "logs.db");
sure_dir_sync(base_path);
this.#use_ffi = parse_bool(Deno.env.get("DB_USE_FFI") ?? "false");
if (this.#use_ffi) {
const DB = (await import("./db_ffi.ts")).DbFfi;
Expand Down

0 comments on commit 62dda6b

Please sign in to comment.