How to use the logform.format.metadata 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
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 7 months ago

Package Health Score

82 / 100
Full package analysis