How to use the logform.format.combine function in logform

To help you get started, we’ve selected a few logform 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 new-eden-social / new-eden-social / packages / logger / src / logger.providers.ts View on Github external
useFactory: () => {
      const LOG_LEVEL = process.env.LOG_LEVEL;

      let output = format.json();
      if (process.env.NODE_ENV === 'develop') {
        output = format.combine(
          format.colorize(),
          format.printf((nfo: TransformableInfo) => {
            let formattedOutput = `${nfo.timestamp} ${nfo.level}: ${nfo.message}`;
            if (nfo.metadata && Object.keys(nfo.metadata).length !== 0) {
              formattedOutput += `\n${JSON.stringify(nfo.metadata, null, 4)}`;
            }
            return formattedOutput;
          }),
        );
      }

      return createLogger({
        level: LOG_LEVEL,
        format: format.combine(
          format.metadata(),
          format.timestamp(),
github CacherApp / cacher-run-server / src / lib / server.ts View on Github external
private setupLogger() {
    const level = this.verbose ? 'debug' : 'info';

    const transports = this.logToFile
      ? [new winston.transports.File({ filename: LOG_FILE })]
      : [new winston.transports.Console()];

    this.logger = winston.createLogger({
      level,
      format: format.combine(
        format.colorize(),
        format.timestamp(),
        format.printf(info => `${info.timestamp} ${info.level}: ${info.message}`)
      ),
      transports
    });
  }
}
github breuerfelix / king-bot-api / src / logger.ts View on Github external
constructor() {
		const logFormat = format.combine(
			//format.colorize(),
			format.align(),
			format.printf((x: any) => `${x.level}: ${x.message}`)
		);

		this.log_inst = winston.createLogger({
			level: 'debug',
			format: logFormat,
			transports: [
				new winston.transports.Console()
			]
		});

		this.logz_inst = winston.createLogger({
			level: 'info',
			transports: [
github new-eden-social / new-eden-social / packages / logger / src / logger.providers.ts View on Github external
if (process.env.NODE_ENV === 'develop') {
        output = format.combine(
          format.colorize(),
          format.printf((nfo: TransformableInfo) => {
            let formattedOutput = `${nfo.timestamp} ${nfo.level}: ${nfo.message}`;
            if (nfo.metadata && Object.keys(nfo.metadata).length !== 0) {
              formattedOutput += `\n${JSON.stringify(nfo.metadata, null, 4)}`;
            }
            return formattedOutput;
          }),
        );
      }

      return createLogger({
        level: LOG_LEVEL,
        format: format.combine(
          format.metadata(),
          format.timestamp(),
          output,
        ),
        transports: [
          new transports.Console(),
        ],
      });
    },
  },

logform

An mutable object-based log format designed for chaining & objectMode streams.

MIT
Latest version published 1 month ago

Package Health Score

89 / 100
Full package analysis