From d1eb1132213853a205e49ae7dea2d027a037e38f Mon Sep 17 00:00:00 2001 From: chasers Date: Wed, 30 Jun 2021 15:51:55 -0700 Subject: [PATCH] Lets see what type of errors look like --- pages/api/{error.js => error-console.js} | 0 pages/api/error-pino-logflare.js | 15 +++++++++++++++ pages/api/error-pino.js | 15 +++++++++++++++ 3 files changed, 30 insertions(+) rename pages/api/{error.js => error-console.js} (100%) create mode 100644 pages/api/error-pino-logflare.js create mode 100644 pages/api/error-pino.js diff --git a/pages/api/error.js b/pages/api/error-console.js similarity index 100% rename from pages/api/error.js rename to pages/api/error-console.js diff --git a/pages/api/error-pino-logflare.js b/pages/api/error-pino-logflare.js new file mode 100644 index 0000000..7316cd0 --- /dev/null +++ b/pages/api/error-pino-logflare.js @@ -0,0 +1,15 @@ +import logger from '../../logger/logger' + +export default function handler(req, res) { + + // Lets log an error with console here. + try { + throw new Error('Whoops!') + } catch (e) { + const onlyPino = require('pino')() + + onlyPino.error(e) + } + + res.status(200).json({ error: 'true' }) +} \ No newline at end of file diff --git a/pages/api/error-pino.js b/pages/api/error-pino.js new file mode 100644 index 0000000..7316cd0 --- /dev/null +++ b/pages/api/error-pino.js @@ -0,0 +1,15 @@ +import logger from '../../logger/logger' + +export default function handler(req, res) { + + // Lets log an error with console here. + try { + throw new Error('Whoops!') + } catch (e) { + const onlyPino = require('pino')() + + onlyPino.error(e) + } + + res.status(200).json({ error: 'true' }) +} \ No newline at end of file