Skip to content

Commit

Permalink
chore(logging): uninstall pino and remove all logs (#1740)
Browse files Browse the repository at this point in the history
  • Loading branch information
SelmaBergstrand authored Nov 20, 2024
1 parent 0a17d79 commit b6163ea
Show file tree
Hide file tree
Showing 9 changed files with 5 additions and 310 deletions.
19 changes: 0 additions & 19 deletions tavla/app/(admin)/utils/serverErrorLogger.ts

This file was deleted.

20 changes: 1 addition & 19 deletions tavla/app/error.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,9 @@ import { Button } from '@entur/button'
import { Heading3 } from '@entur/typography'
import Image from 'next/image'
import Link from 'next/link'
import { useEffect } from 'react'
import BeaverIllustration from 'assets/illustrations/Beaver.png'
import { logServerError } from './(admin)/utils/serverErrorLogger'

export default function Error({
error,
}: {
error: Error & { digest?: string }
}) {
useEffect(() => {
const errorDetails = {
message: error.message,
stack: error.stack,
name: error.name,
cause: error.cause,
digest: error.digest,
}

logServerError(errorDetails)
}, [error])

export default function Error() {
return (
<main className="container pb-10 flex flex-col items-center">
<Heading3>Au da! Noe gikk galt!</Heading3>
Expand Down
20 changes: 2 additions & 18 deletions tavla/app/global-error.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,10 @@ import { Button } from '@entur/button'
import { Heading3 } from '@entur/typography'
import Image from 'next/image'
import Link from 'next/link'
import { useEffect } from 'react'
import BeaverIllustration from 'assets/illustrations/Beaver.png'
import { logServerError } from './(admin)/utils/serverErrorLogger'

export default function Error({
error,
}: {
error: Error & { digest?: string }
}) {
useEffect(() => {
const errorDetails = {
message: error.message,
stack: error.stack,
name: error.name,
cause: error.cause,
digest: error.digest,
}
logServerError(errorDetails)
}, [error])
import BeaverIllustration from 'assets/illustrations/Beaver.png'

export default function Error() {
return (
<html>
<body>
Expand Down
31 changes: 0 additions & 31 deletions tavla/middleware.ts

This file was deleted.

3 changes: 0 additions & 3 deletions tavla/next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@ const nextConfig = {
},
],
},
experimental: {
serverComponentsExternalPackages: ['pino', 'pino-pretty'],
},
}

module.exports = async (phase, { defaultConfig }) => {
Expand Down
2 changes: 0 additions & 2 deletions tavla/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,6 @@
"lodash": "4.17.21",
"nanoid": "5.0.8",
"next": "14.2.4",
"pino": "9.5.0",
"pino-pretty": "11.3.0",
"posthog-js": "1.176.0",
"react": "18.3.1",
"react-dom": "18.3.1",
Expand Down
13 changes: 0 additions & 13 deletions tavla/pages/_error.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,8 @@ import { Button } from '@entur/button'
import { Heading3 } from '@entur/typography'
import Image from 'next/image'
import Link from 'next/link'
import { logger } from 'utils/logger'
import BeaverIllustration from 'assets/illustrations/Beaver.png'
import { NextPageContext } from 'next'

const log = logger.child({ module: 'pagesErrorHandler' })
function Error() {
return (
<main className="container pb-10 flex flex-col items-center">
Expand All @@ -26,14 +23,4 @@ function Error() {
)
}

Error.getInitialProps = ({ res, err }: NextPageContext) => {
const statusCode = res ? res.statusCode : err ? err.statusCode : 404
log.error({
statusCode: statusCode,
error: err,
res: res,
})
return { statusCode }
}

export default Error
38 changes: 0 additions & 38 deletions tavla/src/Shared/utils/logger.ts

This file was deleted.

Loading

0 comments on commit b6163ea

Please sign in to comment.