Skip to content

Commit

Permalink
Testing more stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
7emansell committed Dec 20, 2024
1 parent 215f4c7 commit e4e6c15
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 7 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ We structure our logs according to these [NYPL standards](https://github.com/NYP
Do NOT use `console.log` if you want to add a permanent log, and make sure to clean up your debugging `console.log`s, because they will clutter Cloudwatch and New Relic.

On the server side, DO use `logger.[some NYPL log level](message: string)`.
On the client side, DO use `newrelic.log(message: string, {level: 'debug|error|info|trace|warn'})` OR `newrelic.error(message: string)` (New Relic log levels only partially correspond to NYPL log levels).
On the client side...

## Github Actions

Expand Down
7 changes: 7 additions & 0 deletions app/divisions/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@ export default async function Divisions() {
if (data?.headers?.code === "404") {
redirect("/404");
}

if ((window as any).newrelic) {
(window as any).newrelic.log("test log from divisions server component", {
level: "error",
});
}

return (
<Suspense>
<DivisionsPage summary={data?.summary} divisions={data?.divisions} />
Expand Down
5 changes: 0 additions & 5 deletions app/src/components/pages/divisionsPage/divisionsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,6 @@ export default function DivisionsPage({ summary, divisions }: DivisionsProps) {

useEffect(() => {
setIsLoaded(true);
if ((window as any).newrelic) {
(window as any).newrelic.log("test log from divisions page", {
level: "error",
});
}
}, []);
return (
<PageLayout
Expand Down
4 changes: 3 additions & 1 deletion app/test-error/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ export default function TestError() {
useEffect(() => {
// Send error to New Relic
if ((window as any).newrelic) {
(window as any).newrelic.log("Test error", { level: "warn" });
(window as any).newrelic.log("Test error for New Relic", {
level: "warn",
});
}
throw new Error("Test error");
}, []);
Expand Down

0 comments on commit e4e6c15

Please sign in to comment.