Skip to content

Commit

Permalink
feat: make get_log_level available to plugin, respect log level
Browse files Browse the repository at this point in the history
  • Loading branch information
nilslice authored and chrisdickinson committed Sep 23, 2024
1 parent 8bf9c28 commit 0e44e25
Show file tree
Hide file tree
Showing 10 changed files with 1,236 additions and 679 deletions.
17 changes: 10 additions & 7 deletions examples/deno.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@
#!/usr/bin/env deno run -A
import createPlugin from '../src/mod.ts';
import createPlugin from "../src/mod.ts";

const filename = Deno.args[0] || 'wasm/hello.wasm';
const funcname = Deno.args[1] || 'run_test';
const input = Deno.args[2] || 'this is a test';
const filename = Deno.args[0] || "wasm/hello.wasm";
const funcname = Deno.args[1] || "run_test";
const input = Deno.args[2] || "this is a test";

const plugin = await createPlugin(filename, {
useWasi: true,
logLevel: 'trace',
logger: console,
config: {
thing: 'testing',
thing: "testing",
},
});

console.log("calling", { filename, funcname, input });
const res = await plugin.call(funcname, new TextEncoder().encode(input));
const s = new TextDecoder().decode(res.buffer);
console.log(s);
// const s = new TextDecoder().decode(res.buffer);
// console.log(s);

await plugin.close();
9 changes: 6 additions & 3 deletions examples/node.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,17 @@ async function main() {

const plugin = await createPlugin(filename, {
useWasi: true,
logger: console,
config: { thing: 'testing' },
allowedHosts: ['*.typicode.com'],
runInWorker: true
runInWorker: true,
logLevel: 'trace',
});

console.log('calling', { filename, funcname, input });
const res = await plugin.call(funcname, new TextEncoder().encode(input));
const s = new TextDecoder().decode(res.buffer);
console.log(s);
// const s = new TextDecoder().decode(res.buffer);
// console.log(s);

await plugin.close();
}
Expand Down
Loading

0 comments on commit 0e44e25

Please sign in to comment.