@loglin/reporter-console
Advanced tools
Comparing version 0.0.4 to 0.0.5
@@ -6,2 +6,21 @@ # Change Log | ||
## [0.0.5](https://github.com/loglin/loglin/compare/@loglin/reporter-console@0.0.4...@loglin/reporter-console@0.0.5) (2021-01-10) | ||
### Bug Fixes | ||
* **reporter-console:** show correct error message ([b867ee0](https://github.com/loglin/loglin/commit/b867ee061b6b1e61e4cc39456ed64c54cac4831f)) | ||
### Reverts | ||
* Revert "test: disable colors in tests & CI" ([573d7ec](https://github.com/loglin/loglin/commit/573d7ec5ee9b49de0780f878b5eb030a333aa928)) | ||
* Revert "test: testing inline snapshot for CI" ([6f66957](https://github.com/loglin/loglin/commit/6f66957309866d2d2bc7cf6046ab1ef7f94aa587)) | ||
* Revert "test: updated snapshots" ([e17f1b0](https://github.com/loglin/loglin/commit/e17f1b0d742ecf4b14c51ea7d055201dd2136817)) | ||
## [0.0.4](https://github.com/loglin/loglin/compare/@loglin/reporter-console@0.0.3...@loglin/reporter-console@0.0.4) (2021-01-08) | ||
@@ -8,0 +27,0 @@ |
/*! | ||
* @loglin/reporter-console v0.0.3 | ||
* @loglin/reporter-console v0.0.4 | ||
* (c) 2021 Marvin Rudolph | ||
@@ -122,3 +122,3 @@ * @license MIT | ||
} | ||
const stack = "\n\n" + parseStack(error.stack).map((line) => " " + line.replace(/^at +/, (m) => chalk__default['default'].gray(m)).replace(/\((.+)\)/, (_, m) => `(${chalk__default['default'].cyan(m)})`)).join("\n"); | ||
const stack = "\n\n" + parseStack(error.stack).map((line) => " " + line.replace(/^at +/, (m) => chalk__default['default'].gray(m)).replace(/\((.+)\)/, (_, m) => `(${chalk__default['default'].cyan(m)})`)).join("\n") + "\n"; | ||
return stack; | ||
@@ -137,5 +137,7 @@ } | ||
const textColor = colors[level].text; | ||
let fancyMessage = isThemeTextColor(textColor) ? message : chalkColor(textColor)(message); | ||
let fancyMessage = message; | ||
if (message instanceof Error) { | ||
fancyMessage += formatError(message); | ||
fancyMessage = (isThemeTextColor(textColor) ? message.message : chalkColor(textColor)(message.message)) + formatError(message); | ||
} else if (!isThemeTextColor(textColor)) { | ||
fancyMessage = chalkColor(textColor)(message); | ||
} | ||
@@ -153,6 +155,3 @@ const cachedLabel = labels[level]; | ||
const formatter = options?.formatter || basicFormatter(); | ||
const filters = options?.filters; | ||
return (info) => { | ||
if (filters && filters.length && loglin.isFiltered(filters, info)) | ||
return false; | ||
const formattedMessage = formatter(info); | ||
@@ -159,0 +158,0 @@ const logger = loglin.getLevelNumber(info.level) < 2 ? process.stderr : process.stdout; |
import chalk from 'chalk'; | ||
import { CreatedReporter } from 'loglin'; | ||
import { FormatterFunction } from 'loglin'; | ||
import { LogLevels } from 'loglin'; | ||
import { ReporterFunction } from 'loglin'; | ||
@@ -14,3 +14,3 @@ export declare const basicFormatter: FormatterFunction; | ||
export declare const consoleReporter: ReporterFunction; | ||
export declare const consoleReporter: CreatedReporter; | ||
@@ -17,0 +17,0 @@ export declare const createLabel: (level: LogLevels, colors?: LevelColors) => string; |
/*! | ||
* @loglin/reporter-console v0.0.3 | ||
* @loglin/reporter-console v0.0.4 | ||
* (c) 2021 Marvin Rudolph | ||
* @license MIT | ||
*/ | ||
import { createFormatter, createReporter, isFiltered, getLevelNumber } from 'loglin'; | ||
import { createFormatter, createReporter, getLevelNumber } from 'loglin'; | ||
import chalk, { bold } from 'chalk'; | ||
@@ -114,3 +114,3 @@ import { sep } from 'path'; | ||
} | ||
const stack = "\n\n" + parseStack(error.stack).map((line) => " " + line.replace(/^at +/, (m) => chalk.gray(m)).replace(/\((.+)\)/, (_, m) => `(${chalk.cyan(m)})`)).join("\n"); | ||
const stack = "\n\n" + parseStack(error.stack).map((line) => " " + line.replace(/^at +/, (m) => chalk.gray(m)).replace(/\((.+)\)/, (_, m) => `(${chalk.cyan(m)})`)).join("\n") + "\n"; | ||
return stack; | ||
@@ -129,5 +129,7 @@ } | ||
const textColor = colors[level].text; | ||
let fancyMessage = isThemeTextColor(textColor) ? message : chalkColor(textColor)(message); | ||
let fancyMessage = message; | ||
if (message instanceof Error) { | ||
fancyMessage += formatError(message); | ||
fancyMessage = (isThemeTextColor(textColor) ? message.message : chalkColor(textColor)(message.message)) + formatError(message); | ||
} else if (!isThemeTextColor(textColor)) { | ||
fancyMessage = chalkColor(textColor)(message); | ||
} | ||
@@ -145,6 +147,3 @@ const cachedLabel = labels[level]; | ||
const formatter = options?.formatter || basicFormatter(); | ||
const filters = options?.filters; | ||
return (info) => { | ||
if (filters && filters.length && isFiltered(filters, info)) | ||
return false; | ||
const formattedMessage = formatter(info); | ||
@@ -151,0 +150,0 @@ const logger = getLevelNumber(info.level) < 2 ? process.stderr : process.stdout; |
{ | ||
"name": "@loglin/reporter-console", | ||
"version": "0.0.4", | ||
"version": "0.0.5", | ||
"description": "@loglin/reporter-console", | ||
@@ -20,3 +20,3 @@ "repository": { | ||
"chalk": "^4.1.0", | ||
"loglin": "^0.0.4" | ||
"loglin": "^0.0.5" | ||
}, | ||
@@ -26,3 +26,3 @@ "publishConfig": { | ||
}, | ||
"gitHead": "d8901bc6d8c20ded9e31ed1f56434d9705e5bd94" | ||
"gitHead": "04a9fd64bbdb32751b1bd9460869ea78399557c9" | ||
} |
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
14886
7
1
24
332
Updatedloglin@^0.0.5