node chalk

    技术2022-07-11  131

    node chalk

    As you work more and more with Node.js, you start to see the value of good logging, especially to the console.  The problem you run into, however, is that constantly adding logged messages means that the most important messages can get lost in the shuffle.  Info messages should look one way and app-killing errors should look another.  The Node.js module to help us accomplish custom formatting of messages?  Chalk!

    随着您与Node.js的合作越来越多,您开始看到良好的日志记录的价值,尤其是对于控制台。 但是,您遇到的问题是,不断添加记录的消息意味着最重要的消息可能会在混洗中丢失。 信息消息应该以一种方式出现,而应用程序杀死错误应该以另一种方式出现。 Node.js模块可帮助我们完成消息的自定义格式? 粉笔 !

    Chalk has a very easy to follow, simple to use API.  Here are a few code examples:

    Chalk具有非常易于遵循,易于使用的API。 以下是一些代码示例:

    const chalk = require('chalk'); // style a string chalk.blue('Hello world!'); // combine styled and normal strings chalk.blue('Hello') + 'World' + chalk.red('!'); // compose multiple styles using the chainable API chalk.blue.bgRed.bold('Hello world!'); // pass in multiple arguments chalk.blue('Hello', 'World!', 'Foo', 'bar', 'biz', 'baz'); // nest styles chalk.red('Hello', chalk.underline.bgBlue('world') + '!');

    You can chain methods like bold onto color names, and visa versa.  You can also append Chalk'd strings or add them as separate arguments.  Chalk is very flexible without modifying the String prototype which is impressive.

    您可以将bold方法链接到颜色名称上,反之亦然。 您还可以附加Chalk字符串或将其添加为单独的参数。 Chalk非常灵活,无需修改String原型,令人印象深刻。

    Apparently over 5,000 projects use Chalk and I can see why!  Big problems should come with big colors and lessor debugging information should be less prominent.  Happy coding!

    显然有超过5,000个项目使用Chalk,我明白了原因! 大问题应该带有大的色彩,而更少的调试信息应该不那么突出。 编码愉快!

    翻译自: https://davidwalsh.name/chalk

    node chalk

    相关资源:jdk-8u281-windows-x64.exe
    Processed: 0.009, SQL: 9