Skip to content

Commit

Permalink
feat: allow multiple args and types to log helper (#646)
Browse files Browse the repository at this point in the history
  • Loading branch information
wellwelwel authored Aug 3, 2024
1 parent 49f6291 commit 8f2b6c4
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/modules/helpers/log.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
import { parseResultType } from '../../parsers/assert.js';
import { Write } from '../../services/write.js';

/** By default **Poku** only shows outputs generated from itself. This helper allows you to use an alternative to `console.log` with **Poku**. */
export const log = (message: string) => Write.log(`\x1b[0m${message}\x1b[0m`);
export const log = (...args: unknown[]) => {
const parsedMessages = args
.map((arg) => parseResultType(arg))
.join(' ')
.split('\n')
.map((line) => `\x1b[0m${line}\x1b[0m`)
.join('\n');

Write.log(parsedMessages);
};

0 comments on commit 8f2b6c4

Please sign in to comment.