-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* setup eslint style * rules for quotes * add eslint plugin ts * wip configs * wip * add rules * define rules * add comment * add implementation from old breadcrumbs branch * tests passing * add todo * WIP * cleaning up and adding docs * scoping breadcrumbs in error handler * improving tests * cleanup tests * fix eslint * prettier * moved method * add Breadcrumb object test * add Breadcrumb object test * fix test * expanded the express-example * prettier * prettier * add breadcrumbs to domains app * cleanup and test for clear breadcrumbs * prettier * rename * refactor debug statements * rename logger.js to raygun.client.js * prettier * rename * document Breadcrumbs and rename Breadcrumb type * improve docs * add word * removed commented out code
- Loading branch information
1 parent
a95d14c
commit 57ceec3
Showing
17 changed files
with
663 additions
and
29 deletions.
There are no files selected for viewing
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
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
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
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,16 @@ | ||
var config = require("config"); | ||
|
||
if (config.Raygun.Key === "YOUR_API_KEY") { | ||
console.error( | ||
"[Raygun4Node-Express-Sample] You need to set your Raygun API key in the config file", | ||
); | ||
process.exit(1); | ||
} | ||
|
||
// Setup Raygun | ||
var raygun = require("raygun"); | ||
var raygunClient = new raygun.Client().init({ | ||
apiKey: config.Raygun.Key, | ||
}); | ||
|
||
module.exports = raygunClient; |
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
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
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,18 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title><%= title %></title> | ||
<link rel='stylesheet' href='/stylesheets/style.css' /> | ||
</head> | ||
<body> | ||
<h1><%= title %></h1> | ||
<p><%= title %></p> | ||
<div> | ||
<%= body %> | ||
</div> | ||
|
||
<div> | ||
<a href="/">Back to index</a> | ||
</div> | ||
</body> | ||
</html> |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,34 @@ | ||
import type { Request } from "express"; | ||
import type { Breadcrumb } from "./types"; | ||
import { getBreadcrumbs } from "./raygun.breadcrumbs"; | ||
|
||
const debug = require("debug")("raygun"); | ||
|
||
/** | ||
* Parses an ExpressJS Request and adds it to the breadcrumbs store | ||
* @param request | ||
*/ | ||
export function addRequestBreadcrumb(request: Request) { | ||
const crumbs = getBreadcrumbs(); | ||
|
||
if (!crumbs) { | ||
debug( | ||
"[raygun.breadcrumbs.express.ts] Add request breadcrumb skip, no store!", | ||
); | ||
return; | ||
} | ||
|
||
const internalCrumb: Breadcrumb = { | ||
category: "http", | ||
message: `${request.method} ${request.url}`, | ||
level: "info", | ||
timestamp: Number(new Date()), | ||
type: "request", | ||
}; | ||
|
||
debug( | ||
`[raygun.breadcrumbs.express.ts] recorded request breadcrumb: ${internalCrumb}`, | ||
); | ||
|
||
crumbs.push(internalCrumb); | ||
} |
Oops, something went wrong.