@docusaurus/logger
Advanced tools
Comparing version 0.0.0-4430 to 0.0.0-4432
@@ -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": "0.0.0-4430", | ||
"version": "0.0.0-4432", | ||
"description": "An encapsulated logger for semantically formatting console messages.", | ||
@@ -32,3 +32,3 @@ "main": "./lib/index.js", | ||
}, | ||
"gitHead": "548160af2a7413bdb58a37c37b73ff65be106db9" | ||
"gitHead": "1221cc7c66b95d2207c935645d303be70642514b" | ||
} |
@@ -55,2 +55,9 @@ /** | ||
function stringify(msg: unknown): string { | ||
if (String(msg) === '[object Object]') { | ||
return JSON.stringify(msg); | ||
} | ||
return String(msg); | ||
} | ||
function info(msg: unknown): void; | ||
@@ -65,3 +72,3 @@ function info( | ||
values.length === 0 | ||
? msg | ||
? stringify(msg) | ||
: interpolate(msg as TemplateStringsArray, ...values) | ||
@@ -81,3 +88,3 @@ }`, | ||
values.length === 0 | ||
? msg | ||
? stringify(msg) | ||
: interpolate(msg as TemplateStringsArray, ...values) | ||
@@ -98,3 +105,3 @@ }`, | ||
values.length === 0 | ||
? msg | ||
? stringify(msg) | ||
: interpolate(msg as TemplateStringsArray, ...values) | ||
@@ -114,3 +121,3 @@ }`, | ||
values.length === 0 | ||
? msg | ||
? stringify(msg) | ||
: interpolate(msg as TemplateStringsArray, ...values) | ||
@@ -117,0 +124,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
111007
267