refactor(logging): centralize console output
This commit is contained in:
+4
-1
@@ -14,6 +14,9 @@ import { useEffect } from "react";
|
||||
import Link from "next/link";
|
||||
|
||||
import { ROUTES } from "@/router/routes";
|
||||
import { Logger } from "@/utils";
|
||||
|
||||
const log = new Logger("AppError");
|
||||
|
||||
interface ErrorProps {
|
||||
error: Error & { digest?: string };
|
||||
@@ -23,7 +26,7 @@ interface ErrorProps {
|
||||
export default function GlobalError({ error, unstable_retry }: ErrorProps) {
|
||||
useEffect(() => {
|
||||
// 把错误送到 console;后续接 Sentry/Datadog 时改这里。
|
||||
console.error("[app/error.tsx]", error);
|
||||
log.error("[app/error.tsx]", error);
|
||||
}, [error]);
|
||||
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user