diff --git a/README.md b/README.md index ab981aa..1d7d92d 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,6 @@ Largely inspired from the great pino-colada project but with all the bells and w - [Features](#features) - [SAMPLES](#samples) - [Gruvbox](#gruvbox) - - [Dracula](#dracula) - [Goals](#goals) - [Install](#install) - [Usage](#usage) @@ -30,12 +29,6 @@ Largely inspired from the great pino-colada project but with all the bells and w #### Gruvbox -![Basic Formatting](./media/screenshot3.png) - -![Error Formatting](./media//screenshot4.png) - -#### Dracula - ![Basic Formatting](./media/screenshot1.png) ![Error Formatting](./media/screenshot2.png) @@ -147,7 +140,7 @@ module.exports = { /** * The color of boolean and null values */ - literal: chalk.default + literal: chalk.default, }), /** @@ -163,7 +156,7 @@ module.exports = { formatDate: (date) => {}, formatName: (name) => {}, formatMessage: (message) => {}, - formatBundleSize:(bundleSize) => {}, + formatBundleSize: (bundleSize) => {}, formatNs: (ns) => {}, formatExtraFields: (extraFields) => {}, formatStack: (stack) => {}, @@ -171,7 +164,7 @@ module.exports = { formatStatusCode: (statusCode) => {}, formatErrorProp: (err) => {}, formatMethod: (method) => {}, - formatId: (id) => {} - } + formatId: (id) => {}, + }, }; ``` diff --git a/lib/prettify.ts b/lib/prettify.ts index ada8e46..f859c32 100644 --- a/lib/prettify.ts +++ b/lib/prettify.ts @@ -91,7 +91,7 @@ export function formatLoadTime(elapsedTime: string | number): string { } export function formatTime(instant: string | number): string { - return chalk.gray(`[${format(new Date(instant), 'h:mm:ss:Sbbbbb')}]`); + return chalk.gray(`[${format(new Date(instant), 'h:mm:ss:SS aaa')}]`); } export function formatName(name: string): string { @@ -234,8 +234,8 @@ export function prettify({ msg: formatMessage, responseTime: formatLoadTime, extraFields: formatExtraFields, - err: formatErrorProp, - 'err.stack': formatStack, + [errorKey]: formatErrorProp, + [`${errorKey}.stack`]: formatStack, ...format, }; diff --git a/media/screenshot1.png b/media/screenshot1.png index 924bcc2..787215e 100644 Binary files a/media/screenshot1.png and b/media/screenshot1.png differ diff --git a/media/screenshot2.png b/media/screenshot2.png index ff18423..3ce8476 100644 Binary files a/media/screenshot2.png and b/media/screenshot2.png differ diff --git a/media/screenshot3.png b/media/screenshot3.png deleted file mode 100644 index 8a99ec7..0000000 Binary files a/media/screenshot3.png and /dev/null differ diff --git a/media/screenshot4.png b/media/screenshot4.png deleted file mode 100644 index efdb5ee..0000000 Binary files a/media/screenshot4.png and /dev/null differ diff --git a/scripts/create-sample-output.js b/scripts/create-sample-output.js index 01ee8c4..e620bc7 100644 --- a/scripts/create-sample-output.js +++ b/scripts/create-sample-output.js @@ -47,6 +47,7 @@ const createLogLine = (level, ns, extra, msg, status = true) => level, name: 'HTTP', msg: msg ?? `This is a ${ns} message`, + time: new Date(), req: { method: 'POST', url: `/api/${ns}`, @@ -114,6 +115,7 @@ console.log(); console.log( prettify({ level: 50, + time: new Date(), err: { type: 'Error', message: 'example error', @@ -132,6 +134,7 @@ const aggErr2 = new Error('throw em all the time!'); console.log( prettify({ level: 60, + time: new Date(), msg: 'What about aggregate errors??', err: { message: 'the primary aggregate error',