Socket
Socket
Sign inDemoInstall

@docusaurus/logger

Package Overview
Dependencies
7
Maintainers
6
Versions
981
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @docusaurus/logger

An encapsulated logger for semantically formatting console messages.


Version published
Weekly downloads
293K
decreased by-17.38%
Maintainers
6
Created
Weekly downloads
 

Changelog

Source

2.0.0-beta.14 (2021-12-21)

:rocket: New Feature
  • docusaurus-theme-classic, docusaurus-theme-common
    • #6132 feat(theme-classic): new configuration syntax for a simple footer (@christopherklint97)
    • #6125 feat(theme-common): stable classname for code blocks (@Josh-Cena)
  • docusaurus-theme-classic
    • #5848 feat(theme-classic): standalone Admonition component (@Josh-Cena)
    • #6082 feat(theme-classic): allow passing additional attributes to tab headings (@Drylozu)
  • docusaurus-plugin-content-blog
  • docusaurus
    • #6107 feat(core): allow plugins to customize/override Webpack devServer config (@slorber)
:bug: Bug Fix
  • docusaurus-migrate
  • docusaurus-theme-classic
    • #6128 fix: do not use aria-hidden in heading anchor links (@lex111)
  • docusaurus-plugin-content-docs
    • #6124 fix(content-docs): restore behavior when pagination front matter is null (@Josh-Cena)
    • #6085 fix(content-docs): getMainDocId should return doc with both versioned or unversioned id (@slorber)
  • docusaurus-theme-classic, docusaurus-utils-validation
  • docusaurus-plugin-google-analytics, docusaurus-plugin-google-gtag, docusaurus-plugin-pwa, docusaurus-remark-plugin-npm2yarn, docusaurus-theme-live-codeblock, docusaurus-theme-search-algolia, lqip-loader
  • docusaurus-theme-translations
    • #6088 fix(theme-translations): publish theme-translation lib, including typedef (@slorber)
:nail_care: Polish
  • docusaurus-theme-classic
  • create-docusaurus, docusaurus-logger, docusaurus-mdx-loader, docusaurus-migrate, docusaurus-plugin-client-redirects, docusaurus-plugin-content-blog, docusaurus-plugin-content-docs, docusaurus-theme-classic, docusaurus-theme-search-algolia, docusaurus-theme-translations, docusaurus-utils-validation, docusaurus-utils, docusaurus
  • create-docusaurus
    • #6119 fix(create-docusaurus): make initial editUrl functional (@Josh-Cena)
    • #6095 fix(create-docusaurus): give a clearer message when installation failed (@Josh-Cena)
:memo: Documentation
:house: Internal
  • docusaurus-theme-classic
    • #6144 fix(theme-classic): fix translation when footer has no links (@Josh-Cena)
  • docusaurus-plugin-content-docs
  • Other
  • create-docusaurus, docusaurus-cssnano-preset, docusaurus-mdx-loader, docusaurus-migrate, docusaurus-plugin-client-redirects, docusaurus-plugin-content-blog, docusaurus-plugin-content-docs, docusaurus-plugin-content-pages, docusaurus-plugin-debug, docusaurus-plugin-google-analytics, docusaurus-plugin-google-gtag, docusaurus-plugin-ideal-image, docusaurus-plugin-pwa, docusaurus-plugin-sitemap, docusaurus-preset-classic, docusaurus-remark-plugin-npm2yarn, docusaurus-theme-classic, docusaurus-theme-common, docusaurus-theme-live-codeblock, docusaurus-theme-search-algolia, docusaurus-theme-translations, docusaurus-types, docusaurus-utils-common, docusaurus-utils-validation, docusaurus-utils, docusaurus, lqip-loader
Committers: 17

Readme

Source

@docusaurus/logger

An encapsulated logger for semantically formatting console messages.

APIs

It exports a single object as default export: logger. logger has the following properties:

  • Some useful colors.
  • Formatters. These functions have the same signature as the formatters of 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.
  • The interpolate function. It is a template literal tag.
  • Logging functions. All logging functions can both be used as functions (in which it has the same usage as 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.

Using the template literal tag

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:

demo

FAQs

Last updated on 21 Dec 2021

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc