Important
This project is deprecated use Nuxt-Layers instead.
Default logger use for all nuxt apps.
To install the module create a .npmrc next to your package.json file:
//npm.pkg.github.com/:_authToken=${GITHUB_TOKEN}
@dcc-bs:registry=https://npm.pkg.github.comCreate a github personal access token (classic) with read:packages permissions and add it to your .env file:
GITHUB_TOKEN='YOUR_TOKEN'Install the module to your Nuxt application with:
bun x nuxi module add @dcc-bs/logger.bs.jsThat's it! You can now use logger.bs.js in your Nuxt app ✨
You can get the logger over the composable useLogger:
const logger = useLogger();
logger.infor('log a info message');
logger.warn('log a warn message');
logger.error('log a error');On the api side you can get the logger with the util function getEventLogger:
export default defineEventHandler(async (event) => {
const logger = getEventLogger(event);
logger.info('log messages');
});when the module is installed all failed request will be logged as an error.
Commit your changes and then:
bun release