How to use the kafkajs.logLevel.NOTHING function in kafkajs

To help you get started, we’ve selected a few kafkajs 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 erikengervall / dockest / packages / examples / multiple-resources / kafka-1-kafkajs / app.ts View on Github external
const { Kafka, logLevel } = require('kafkajs') // eslint-disable-line @typescript-eslint/no-var-requires

type JestFn = (_: any) => void

const kafka = new Kafka({
  brokers: ['localhost:9092'],
  clientId: 'dockest_example',
  logLevel: logLevel.NOTHING,
  retry: {
    initialRetryTime: 2500,
    retries: 10,
  },
})

const createConsumer = (
  mockConsumptionCallback: JestFn,
): { consumer: any; startConsuming: () => Promise; stopConsuming: () => Promise } => {
  const consumer = kafka.consumer({ groupId: 'dockest_group_1' })

  const startConsuming = async () => {
    await consumer.connect()
    await consumer.subscribe({ topic: 'dockesttopic' })
    await consumer.run({
      eachMessage: async ({
github al66 / imicros-flow / lib / flow.static.subscriber.mixed.js View on Github external
this.serviceLogger = kafkalogLevel => ({ namespace, level, label, log }) => {
            switch(level) {
              case logLevel.ERROR:
              case logLevel.NOTHING:
                return this.logger.error("KAFKAJS: " + namespace + log.message, log);
              case logLevel.WARN:
                return this.logger.warn("KAFKAJS: " + namespace + log.message, log);
              case logLevel.INFO:
                return this.logger.info("KAFKAJS: " + namespace + log.message, log);
              case logLevel.DEBUG:
                return this.logger.debug("KAFKAJS: " + namespace + log.message, log);
            }
        }
github al66 / imicros-flow / lib / flow.publisher.js View on Github external
this.serviceLogger = () => ({ level, log }) => {
            switch(level) {
                case logLevel.ERROR:
                case logLevel.NOTHING:
                    return this.logger.error("namespace:" + log.message, log);
                case logLevel.WARN:
                    return this.logger.warn("namespace:" + log.message, log);
                case logLevel.INFO:
                    return this.logger.info("namespace:" + log.message, log);
                case logLevel.DEBUG:
                    return this.logger.debug("namespace:" + log.message, log);
            }
        };
github al66 / imicros-flow / lib / flow.publisher.kafkajs.js View on Github external
this.serviceLogger = () => ({ level, log }) => {
            switch(level) {
                case logLevel.ERROR:
                case logLevel.NOTHING:
                    return this.logger.error("namespace:" + log.message, log);
                case logLevel.WARN:
                    return this.logger.warn("namespace:" + log.message, log);
                case logLevel.INFO:
                    return this.logger.info("namespace:" + log.message, log);
                case logLevel.DEBUG:
                    return this.logger.debug("namespace:" + log.message, log);
            }
        };
github al66 / imicros-flow / lib / flow.static.subscriber.js View on Github external
this.serviceLogger = () => ({ namespace, level, log }) => {
            switch(level) {
                case logLevel.ERROR:
                case logLevel.NOTHING:
                    return this.logger.error("KAFKAJS: " + namespace + log.message, log);
                case logLevel.WARN:
                    return this.logger.warn("KAFKAJS: " + namespace + log.message, log);
                case logLevel.INFO:
                    return this.logger.info("KAFKAJS: " + namespace + log.message, log);
                case logLevel.DEBUG:
                    return this.logger.debug("KAFKAJS: " + namespace + log.message, log);
            }
        };

kafkajs

A modern Apache Kafka client for node.js

MIT
Latest version published 2 years ago

Package Health Score

81 / 100
Full package analysis