nexlog: A Lightweight, Zero-Dependency Logging Library for Next.js
Hello Vercel community! I’m excited to share nexlog, a logging library I’ve developed specifically for Next.js applications.
Key Features
- Works seamlessly with both RSC and client components
- Zero external dependencies
- Full TypeScript support
- Environment-aware (Server, Browser, Edge)
- Customizable log levels
- Colored console output for server environments
- Lightweight and easy to use
Why nexlog?
I created nexlog to address the need for a simple, efficient logging solution in the Next.js ecosystem. It’s designed to be flexible, performant, and easy to integrate, whether you’re working with server-side rendering, client-side components, or edge functions.
Quick Start
Install nexlog:
npm install nexlog
Configure Next.js (in next.config.js
or next.config.mjs
):
/** @type {import('next').NextConfig} */
const nextConfig = {
transpilePackages: ["nexlog"],
};
export default nextConfig;
Use in your components:
import logger from 'nexlog';
logger.info('This is an info message');
logger.warn('This is a warning', { additionalInfo: 'Some extra data' });
GitHub Repository
For more details, examples, and to contribute: https://github.com/Arakiss/nexlog
I’d love to hear your thoughts and feedback. Feel free to try it out and let me know what you think!