How to use the loglevelnext.create function in loglevelnext

To help you get started, we’ve selected a few loglevelnext 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 shellscape / webpack-plugin-serve / lib / log.js View on Github external
const symbol = ['error', 'warn'].includes(level) ? symbols.whoops : symbols.ok;
      return chalk[color](`${symbol} wps: `);
    },
    template: '{{level}}'
  };

  /* istanbul ignore if */
  if (options.timestamp) {
    prefix.template = `[{{time}}] ${prefix.template}`;
  }

  /* eslint-disable no-param-reassign */
  options.prefix = prefix;
  options.name = 'webpack-plugin-serve';

  const log = loglevel.create(options);

  return log;
};
github shellscape / webpack-plugin-serve / framework / log.js View on Github external
const color = colors[level];
      const symbol = ['error', 'warn'].includes(level) ? symbols.whoops : symbols.ok;
      return chalk[color](`${symbol} ${logName}: `);
    },
    template: '{{level}}'
  };

  if (options.timestamp) {
    prefix.template = `[{{time}}] ${prefix.template}`;
  }

  /* eslint-disable no-param-reassign */
  options.prefix = prefix;
  options.name = logName;

  const log = loglevel.create(options);

  return log;
};
github shellscape / apollo-log / lib / index.js View on Github external
constructor(options) {
    const opts = Object.assign({}, defaults, options);
    const template = `${opts.timestamp ? '[{{time}}] ' : ''}{{level}}`;
    const prefix = {
      level: ({ level }) => {
        const color = colors[level];
        return chalk[color](opts.prefix);
      },
      template,
      time: () => new Date().toTimeString().split(' ')[0]
    };

    const log = loglevel.create({ level: opts.level, name: 'apollo-log', prefix });

    this.log = {
      info: (args) => {
        const mutated = opts.mutate(...['info'].concat(args));
        log.info(mutated || args);
      },

      debug: (args) => {
        const mutated = opts.mutate(...['debug'].concat(args));
        log.debug(mutated || args);
      }
    };

    this.options = opts;
  }
github shellscape / webpack-log / lib / index.js View on Github external
level: ({ level }) => {
      const color = colors[level];
      const symbol = ['error', 'warn'].includes(level) ? symbols.whoops : symbols.ok;
      return chalk[color](`${symbol} ${options.name}: `);
    },
    template: '{{level}}'
  };

  if (options.timestamp) {
    prefix.template = `[{{time}}] ${prefix.template}`;
  }

  options.id = options.name + (options.unique ? nanoid() : '');
  options.prefix = prefix;

  const log = loglevel.create(options);

  return log;
};

loglevelnext

A modern logging library for Node.js and modern browsers that provides log level mapping to the console

MPL-2.0
Latest version published 1 year ago

Package Health Score

56 / 100
Full package analysis