Skip to content

Commit

Permalink
ensure for log file
Browse files Browse the repository at this point in the history
  • Loading branch information
jjallaire committed Apr 14, 2022
1 parent 4ceaef7 commit 3ad0ec7
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/core/log.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
* Copyright (C) 2020 by RStudio, PBC
*
*/

import { ensureDirSync } from "fs/mod.ts";
import { dirname } from "path/mod.ts";
import * as colors from "fmt/colors.ts";
import * as log from "log/mod.ts";
import { LogRecord } from "log/logger.ts";
Expand Down Expand Up @@ -66,6 +69,9 @@ export function appendLogOptions(cmd: Command): Command {
export function logOptions(args: Args) {
const logOptions: LogOptions = {};
logOptions.log = args.l || args.log || Deno.env.get("QUARTO_LOG");
if (logOptions.log) {
ensureDirSync(dirname(logOptions.log));
}
logOptions.level = args.ll || args["log-level"] ||
Deno.env.get("QUARTO_LOG_LEVEL");
logOptions.quiet = args.q || args.quiet;
Expand Down

0 comments on commit 3ad0ec7

Please sign in to comment.