diff --git a/src/presets/fancy.ts b/src/presets/fancy.ts index 3659974..6b08ca9 100644 --- a/src/presets/fancy.ts +++ b/src/presets/fancy.ts @@ -8,20 +8,21 @@ const getDateTimeString = (date: Date) => { const hours = date.getHours(); const minutes = date.getMinutes(); const seconds = date.getSeconds(); - return chalk.gray(`${day}/${month}/${year} ${hours}:${minutes}:${seconds}`); + return `${day}/${month}/${year} ${hours}:${minutes}:${seconds}`; }; const preset: PresetValue = { uses: ['time', 'method', 'path'], formatAttr: { onSuccess({ time, method, path }) { - const dateTime = getDateTimeString(time!!); + const dateTime = chalk.gray(getDateTimeString(time!!)); const methodPath = chalk.cyan(`${method} ${path}`); return `${dateTime} ${methodPath}`; }, - onFailure() { - return ''; + onFailure({ request, datetime }) { + const dateTime = getDateTimeString(datetime!!); + return chalk.red(`${dateTime} ${request.method} ${request.url}`); } } };