How to use the @pact-foundation/pact-node.logLevel function in @pact-foundation/pact-node

To help you get started, we’ve selected a few @pact-foundation/pact-node 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 pact-foundation / pact-js / src / pact.ts View on Github external
if (isEmpty(this.opts.provider)) {
      throw new Error("You must specify a Provider for this pact.");
    }

    this.server = serviceFactory.createServer({
      cors: this.opts.cors,
      dir: this.opts.dir,
      host: this.opts.host,
      log: this.opts.log,
      port: this.opts.port,
      spec: this.opts.spec,
      ssl: this.opts.ssl,
      sslcert: this.opts.sslcert,
      sslkey: this.opts.sslkey,
    });
    serviceFactory.logLevel(this.opts.logLevel);

    logger.info(`Setting up Pact with Consumer "${this.opts.consumer}" and Provider "${this.opts.provider}"
   using mock service on Port: "${this.opts.port}"`);

    this.mockService = new MockService(this.opts.consumer, this.opts.provider, this.opts.port, this.opts.host,
      this.opts.ssl, this.opts.pactfileWriteMode);
  }
github pact-foundation / pact-js / src / messageProviderPact.ts View on Github external
constructor(private config: MessageProviderOptions) {
    if (config.logLevel && !isEmpty(config.logLevel)) {
      serviceFactory.logLevel(config.logLevel)
      logger.level(config.logLevel)
    } else {
      logger.level()
    }
  }
github pact-foundation / pact-js / src / message-producer.ts View on Github external
constructor(private config: MessageProducerOptions) {
    serviceFactory.logLevel(this.config.logLevel);
  }
github pact-foundation / pact-js / src / messageConsumerPact.ts View on Github external
constructor(private config: MessageConsumerOptions) {
    if (!isEmpty(config.logLevel)) {
      serviceFactory.logLevel(config.logLevel);
    }
  }
github pact-foundation / pact-js / src / pact.js View on Github external
const spec = opts.spec || 2
  const cors = opts.cors || false
  const pactfileWriteMode = opts.pactfileWriteMode || 'overwrite'

  const server = serviceFactory.createServer({
    host: host,
    port: port,
    log: log,
    dir: dir,
    spec: spec,
    ssl: ssl,
    sslcert: sslcert,
    sslkey: sslkey,
    cors: cors
  })
  serviceFactory.logLevel(logLevel)

  logger.info(`Setting up Pact with Consumer "${consumer}" and Provider "${provider}" using mock service on Port: "${port}"`)

  const mockService = new MockService(consumer, provider, port, host, ssl, pactfileWriteMode)

  /** @namespace PactProvider */
  return {

    /**
     * Start the Mock Server.
     * @returns {Promise}
     */
    setup: () => net.isPortAvailable(port, host).then(() => server.start()),

    /**
     * Add an interaction to the {@link MockService}.
github pact-foundation / pact-js / src / dsl / verifier.ts View on Github external
private setConfig(config: VerifierOptions) {
    this.config = config

    if (this.config.logLevel && !isEmpty(this.config.logLevel)) {
      serviceFactory.logLevel(this.config.logLevel)
      logger.level(this.config.logLevel)
    }

    this.deprecatedFields.forEach(f => {
      if ((this.config as any)[f]) {
        logger.warn(
          `${f} is deprecated, and will be removed in future versions`
        )
      }
    })

    if (this.config.validateSSL === undefined) {
      this.config.validateSSL = true
    }

    if (this.config.changeOrigin === undefined) {
github pact-foundation / pact-js / src / httpPact.ts View on Github external
constructor(config: PactOptions) {
    this.opts = Pact.createOptionsWithDefaults(config)

    if (isEmpty(this.opts.consumer)) {
      throw new ConfigurationError("You must specify a Consumer for this pact.")
    }

    if (isEmpty(this.opts.provider)) {
      throw new ConfigurationError("You must specify a Provider for this pact.")
    }

    logger.level(this.opts.logLevel as LogLevels)
    serviceFactory.logLevel(this.opts.logLevel)

    this.createServer(config)
  }

@pact-foundation/pact-node

Core of @pact-foundation/pact. You almost certainly don't want to depend on this directly.

MIT
Latest version published 10 months ago

Package Health Score

74 / 100
Full package analysis