
Security News
High Salaries No Longer Enough to Attract Top Cybersecurity Talent
A survey of 500 cybersecurity pros reveals high pay isn't enough—lack of growth and flexibility is driving attrition and risking organizational security.
calc-test1234
Advanced tools
Have you ever had experience debugging code in getServerSideProps, getStaticProps, or getInitailProps?
It's hard to debug when application is deployed and need some extra steps to see actual logged.
Now use NextServerLogger and see logs in browser. 🎉
NextServerLogger is next.js helper tool
that enable passing server logs, which define inside getServerSideProps, getStaticProps, or getInitialProps, to browser.
yarn add next-server-logger
npm install next-server-logger
// _app.js
import { NextServerLoggerProvider } from 'next-server-logger'
export default function App({ Component, pageProps }) {
return (
<>
<NextServerLoggerProvider pageProps={pageProps} enable={process.env.NEXT_PUBLIC_ENV === 'development'} />
<Component {...pageProps} />
</>
);
}
import { getServerLogger } from 'next-server-logger'
App.getInitialProps = async ({ Component, ctx }) => {
let pageProps = {};
if (Component.getInitialProps) {
pageProps = await Component.getInitialProps(ctx);
}
const logger = getServerLogger();
logger.log('hello world'); // logging
return {
pageProps: {
...pageProps,
...logger.getAppLoggerProps() // ⭐️ need to pass logger props
},
};
};
import { getServerLogger } from 'next-server-logger'
export const getServerSideProps = () => {
const logger = getServerLogger();
logger.log('hello world server side props'); // logging
return {
props: {
...logger.getLoggerProps(), // ⭐️ need to pass logger props
},
};
};
import { getServerLogger } from 'next-server-logger'
export const getStaticProps = () => {
const logger = getServerLogger();
logger.log('hello world static props'); // logging
return {
props: {
...logger.getLoggerProps(), // ⭐️ need to pass logger props
},
};
};
type NextServerLoggerProvider = React.FC<{ pageProps: any, enable?: boolean | true }>
NextServerLoggerProvider has two props, pageProps and enable.
pageProps
is next page props.
enable
can handle logging enabled or not.
type logger.log = (...params: any[]) => void
Logger.log -> pass any params you want to log just like console.log
FAQs
Unknown package
The npm package calc-test1234 receives a total of 0 weekly downloads. As such, calc-test1234 popularity was classified as not popular.
We found that calc-test1234 demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
A survey of 500 cybersecurity pros reveals high pay isn't enough—lack of growth and flexibility is driving attrition and risking organizational security.
Product
Socket, the leader in open source security, is now available on Google Cloud Marketplace for simplified procurement and enhanced protection against supply chain attacks.
Security News
Corepack will be phased out from future Node.js releases following a TSC vote.