@docusaurus/logger
Advanced tools
Comparing version 2.0.0-beta.14 to 2.0.0-beta.15
@@ -47,5 +47,11 @@ "use strict"; | ||
} | ||
function stringify(msg) { | ||
if (String(msg) === '[object Object]') { | ||
return JSON.stringify(msg); | ||
} | ||
return String(msg); | ||
} | ||
function info(msg, ...values) { | ||
console.info(`${chalk_1.default.cyan(chalk_1.default.bold('[INFO]'))} ${values.length === 0 | ||
? msg | ||
? stringify(msg) | ||
: interpolate(msg, ...values)}`); | ||
@@ -55,3 +61,3 @@ } | ||
console.warn(chalk_1.default.yellow(`${chalk_1.default.bold('[WARNING]')} ${values.length === 0 | ||
? msg | ||
? stringify(msg) | ||
: interpolate(msg, ...values)}`)); | ||
@@ -61,3 +67,3 @@ } | ||
console.error(chalk_1.default.red(`${chalk_1.default.bold('[ERROR]')} ${values.length === 0 | ||
? msg | ||
? stringify(msg) | ||
: interpolate(msg, ...values)}`)); | ||
@@ -67,3 +73,3 @@ } | ||
console.log(`${chalk_1.default.green(chalk_1.default.bold('[SUCCESS]'))} ${values.length === 0 | ||
? msg | ||
? stringify(msg) | ||
: interpolate(msg, ...values)}`); | ||
@@ -70,0 +76,0 @@ } |
{ | ||
"name": "@docusaurus/logger", | ||
"version": "2.0.0-beta.14", | ||
"version": "2.0.0-beta.15", | ||
"description": "An encapsulated logger for semantically formatting console messages.", | ||
@@ -32,3 +32,3 @@ "main": "./lib/index.js", | ||
}, | ||
"gitHead": "c4824a8937d8f1aa0806667749cbc74058e2b294" | ||
"gitHead": "9a8acb2a87250368427ad80258350d630e7ae2f5" | ||
} |
@@ -8,3 +8,3 @@ /** | ||
import chalk, {Chalk} from 'chalk'; | ||
import chalk, {type Chalk} from 'chalk'; | ||
@@ -56,2 +56,9 @@ type InterpolatableValue = string | number | (string | number)[]; | ||
function stringify(msg: unknown): string { | ||
if (String(msg) === '[object Object]') { | ||
return JSON.stringify(msg); | ||
} | ||
return String(msg); | ||
} | ||
function info(msg: unknown): void; | ||
@@ -66,3 +73,3 @@ function info( | ||
values.length === 0 | ||
? msg | ||
? stringify(msg) | ||
: interpolate(msg as TemplateStringsArray, ...values) | ||
@@ -82,3 +89,3 @@ }`, | ||
values.length === 0 | ||
? msg | ||
? stringify(msg) | ||
: interpolate(msg as TemplateStringsArray, ...values) | ||
@@ -99,3 +106,3 @@ }`, | ||
values.length === 0 | ||
? msg | ||
? stringify(msg) | ||
: interpolate(msg as TemplateStringsArray, ...values) | ||
@@ -115,3 +122,3 @@ }`, | ||
values.length === 0 | ||
? msg | ||
? stringify(msg) | ||
: interpolate(msg as TemplateStringsArray, ...values) | ||
@@ -118,0 +125,0 @@ }`, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
111010
267
0