Product
Introducing Enhanced Alert Actions and Triage Functionality
Socket now supports four distinct alert actions instead of the previous two, and alert triaging allows users to override the actions taken for all individual alerts.
@docusaurus/logger
Advanced tools
Readme
@docusaurus/logger
An encapsulated logger for semantically formatting console messages.
It exports a single object as default export: logger
. logger
has the following properties:
picocolors
. Note that their implementations are not guaranteed. You should only care about their semantics.
path
: formats a file path or URL.id
: formats an identifier.code
: formats a code snippet.subdue
: subdues the text.num
: formats a number.interpolate
function. It is a template literal tag.console.log
) or template literal tags.
info
: prints information.warn
: prints a warning that should be payed attention to.error
: prints an error (not necessarily halting the program) that signals significant problems.success
: prints a success message.The template literal tag evaluates the template and expressions embedded. interpolate
returns a new string, while other logging functions prints it. Below is a typical usage:
logger.info`Hello name=${name}! You have number=${money} dollars. Here are the ${
items.length > 1 ? 'items' : 'item'
} on the shelf: ${items}
To buy anything, enter code=${'buy x'} where code=${'x'} is the item's name; to quit, press code=${'Ctrl + C'}.`;
An embedded expression is optionally preceded by a flag in the form %[a-z]+
(a percentage sign followed by a few lowercase letters). If it's not preceded by any flag, it's printed out as-is. Otherwise, it's formatted with one of the formatters:
path=
: path
name=
: id
code=
: code
subdue=
: subdue
number=
: num
If the expression is an array, it's formatted by `\n- ${array.join('\n- ')}\n`
(note it automatically gets a leading line end). Each member is formatted by itself and the bullet is not formatted. So you would see the above message printed as:
FAQs
An encapsulated logger for semantically formatting console messages.
The npm package @docusaurus/logger receives a total of 288,954 weekly downloads. As such, @docusaurus/logger popularity was classified as popular.
We found that @docusaurus/logger demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket now supports four distinct alert actions instead of the previous two, and alert triaging allows users to override the actions taken for all individual alerts.
Security News
Polyfill.io has been serving malware for months via its CDN, after the project's open source maintainer sold the service to a company based in China.
Security News
OpenSSF is warning open source maintainers to stay vigilant against reputation farming on GitHub, where users artificially inflate their status by manipulating interactions on closed issues and PRs.