Skip to content

Commit

Permalink
rename
Browse files Browse the repository at this point in the history
  • Loading branch information
mmkal committed May 26, 2024
1 parent 270bd11 commit d9d545d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/logging.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import {LogMethod, Logger} from './types'

export const primitiveOrJsonLogger = getLoggerTransformer(method => {
export const primitiveOrJsonLogger = getLoggerTransformer(log => {
const transformed: LogMethod = (...args) => {
if (args.length === 1 && Array.isArray(args[0])) {
args[0].forEach(item => transformed(item))
} else if (args.every(isPrimitive)) {
method(...args)
log(...args)
} else if (args.length === 1) {
method(JSON.stringify(args[0], null, 2))
log(JSON.stringify(args[0], null, 2))
} else {
method(JSON.stringify(args, null, 2))
log(JSON.stringify(args, null, 2))
}
}

Expand Down
1 change: 1 addition & 0 deletions test/e2e.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import {execa} from 'execa'
import * as path from 'path'
import stripAnsi from 'strip-ansi'
import {expect, test} from 'vitest'
import '../src' // make sure vitest reruns this file after every change

const tsx = async (file: string, args: string[]) => {
const {all} = await execa('./node_modules/.bin/tsx', ['test/fixtures/' + file, ...args], {
Expand Down

0 comments on commit d9d545d

Please sign in to comment.