From 727643848653d3ad8aaaa0aca7c9b3a82f89833a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BA=8C=E8=B4=A7=E7=88=B1=E5=90=83=E7=99=BD=E8=90=9D?= =?UTF-8?q?=E5=8D=9C?= Date: Tue, 17 Jan 2023 14:27:14 +0800 Subject: [PATCH] docs: Report 404 for monitor (#40278) * docs: monitor 404 report * docs: Add source * docs: patch * docs: clean up --- .dumi/pages/404/index.tsx | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/.dumi/pages/404/index.tsx b/.dumi/pages/404/index.tsx index 4f8d37c526..a15eb59726 100644 --- a/.dumi/pages/404/index.tsx +++ b/.dumi/pages/404/index.tsx @@ -1,7 +1,7 @@ -import React, { useEffect } from 'react'; -import { Result, Button } from 'antd'; import { HomeOutlined } from '@ant-design/icons'; +import { Button, Result } from 'antd'; import { Link, useLocation } from 'dumi'; +import React, { useEffect } from 'react'; import * as utils from '../../theme/utils'; export interface NotFoundProps { @@ -29,6 +29,15 @@ const NotFoundPage: React.FC = ({ router }) => { router.replace(utils.getLocalizedPathname(`/${DIRECT_MAP[matchPath]}`, isZhCN).pathname); } } + + // Report if necessary + const { yuyanMonitor } = window as any; + if (yuyanMonitor) { + yuyanMonitor.log({ + code: 11, + msg: `Page not found: ${location.href}; Source: ${document.referrer}`, + }); + } }, []); return (