Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
timonson committed May 20, 2024
1 parent c510189 commit be8f26d
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions functions/log.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { join, queue } from "./deps.ts";
import { basename, dirname, isUrl, join, queue } from "./deps.ts";
import { ensureSymlinkedDataDirectorySync } from "./fs.ts";

/**
Expand All @@ -8,9 +8,11 @@ import { ensureSymlinkedDataDirectorySync } from "./fs.ts";
* log.next("bbbbbbbbb");
* ```
*/
export function logTo(dirname: string, filename: string) {
export function logTo(path: string | URL) {
const dataPath = isUrl(path)
? path
: join(ensureSymlinkedDataDirectorySync(dirname(path)), basename(path));
return queue(async (message: string) => {
const dataPath = join(ensureSymlinkedDataDirectorySync(dirname), filename);
await Deno.writeTextFile(dataPath, message + "\n", { append: true });
});
}

0 comments on commit be8f26d

Please sign in to comment.