How to use the bs-logger.LogContexts.application function in bs-logger

To help you get started, we’ve selected a few bs-logger examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github kulshekhar / ts-jest / src / cli / index.ts View on Github external
import { LogContexts, Logger } from 'bs-logger'
import { Arguments } from 'yargs'
import yargsParser = require('yargs-parser')

import { rootLogger } from '../util/logger'

const VALID_COMMANDS = ['help', 'config:migrate', 'config:init']

const logger = rootLogger.child({ [LogContexts.namespace]: 'cli', [LogContexts.application]: 'ts-jest' })

/**
 * @internal
 */
export type CliCommand = (argv: Arguments, logger: Logger) => Promise

async function cli(args: string[]): Promise {
  const parsedArgv = yargsParser(args, {
    boolean: ['dry-run', 'jest-preset', 'allow-js', 'diff', 'babel', 'force', 'jsdom'],
    string: ['tsconfig', 'js'],
    count: ['verbose'],
    alias: { verbose: ['v'] },
    default: { jestPreset: true, verbose: 0 },
    coerce: {
      js(val: string) {
        const res = val.trim().toLowerCase()