forked from Logflare/next-pino-logflare-logging-example
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Lets see what type of errors look like
- Loading branch information
Showing
3 changed files
with
30 additions
and
0 deletions.
There are no files selected for viewing
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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' }) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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' }) | ||
} |