PHP 8.2.30
Preview: cli.js Size: 1.19 KB
/home/byroehnu/.trash/node_modules11/logform/cli.js

'use strict';

const { Colorizer } = require('./colorize');
const { Padder } = require('./pad-levels');
const { configs, MESSAGE } = require('triple-beam');


/**
 * Cli format class that handles initial state for a a separate
 * Colorizer and Padder instance.
 */
class CliFormat {
  constructor(opts = {}) {
    if (!opts.levels) {
      opts.levels = configs.cli.levels;
    }

    this.colorizer = new Colorizer(opts);
    this.padder = new Padder(opts);
    this.options = opts;
  }

  /*
   * function transform (info, opts)
   * Attempts to both:
   * 1. Pad the { level }
   * 2. Colorize the { level, message }
   * of the given `logform` info object depending on the `opts`.
   */
  transform(info, opts) {
    this.colorizer.transform(
      this.padder.transform(info, opts),
      opts
    );

    info[MESSAGE] = `${info.level}:${info.message}`;
    return info;
  }
}

/*
 * function cli (opts)
 * Returns a new instance of the CLI format that turns a log
 * `info` object into the same format previously available
 * in `winston.cli()` in `winston < 3.0.0`.
 */
module.exports = opts => new CliFormat(opts);

//
// Attach the CliFormat for registration purposes
//
module.exports.Format = CliFormat;

Directory Contents

Dirs: 2 × Files: 30

Name Size Perms Modified Actions
dist DIR
- drwxr-xr-x 2026-02-21 00:53:58
Edit Download
- drwxr-xr-x 2026-02-21 00:53:12
Edit Download
39 B lrw-r--r-- 2026-02-21 00:53:16
Edit Download
105 B lrw-r--r-- 2026-02-21 00:53:18
Edit Download
25 B lrw-r--r-- 2026-02-21 00:53:20
Edit Download
367 B lrw-r--r-- 2026-02-21 00:53:22
Edit Download
1.72 KB lrw-r--r-- 2026-02-21 00:53:24
Edit Download
10.48 KB lrw-r--r-- 2026-02-21 00:54:00
Edit Download
1.19 KB lrw-r--r-- 2026-02-21 00:53:28
Edit Download
2.97 KB lrw-r--r-- 2026-02-21 00:53:32
Edit Download
1.76 KB lrw-r--r-- 2026-02-21 00:53:34
Edit Download
1.19 KB lrw-r--r-- 2026-02-21 00:53:36
Edit Download
1.14 KB lrw-r--r-- 2026-02-21 00:53:38
Edit Download
6.04 KB lrw-r--r-- 2026-02-21 00:54:00
Edit Download
1.83 KB lrw-r--r-- 2026-02-21 00:53:38
Edit Download
983 B lrw-r--r-- 2026-02-21 00:53:40
Edit Download
469 B lrw-r--r-- 2026-02-21 00:53:42
Edit Download
251 B lrw-r--r-- 2026-02-21 00:53:44
Edit Download
1.07 KB lrw-r--r-- 2026-02-21 00:53:22
Edit Download
759 B lrw-r--r-- 2026-02-21 00:53:46
Edit Download
1.30 KB lrw-r--r-- 2026-02-21 00:53:48
Edit Download
430 B lrw-r--r-- 2026-02-21 00:53:50
Edit Download
1.44 KB lrw-r--r-- 2026-02-21 00:53:58
Edit Download
2.81 KB lrw-r--r-- 2026-02-21 00:53:50
Edit Download
899 B lrw-r--r-- 2026-02-21 00:53:52
Edit Download
515 B lrw-r--r-- 2026-02-21 00:53:54
Edit Download
17.66 KB lrw-r--r-- 2026-02-21 00:54:00
Edit Download
979 B lrw-r--r-- 2026-02-21 00:53:56
Edit Download
4.17 KB lrw-r--r-- 2026-02-21 00:53:58
Edit Download
757 B lrw-r--r-- 2026-02-21 00:53:58
Edit Download
384 B lrw-r--r-- 2026-02-21 00:53:58
Edit Download
705 B lrw-r--r-- 2026-02-21 00:53:58
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).