neon-log
v0.0.6
Published
π Colorful console logger for Angular & Node.js. Works in browser DevTools and terminal with neon ANSI colors. Zero config, zero dependencies.
Maintainers
Readme
NeonLog π
Colorful console logger for Angular & Node.js. Works in browser DevTools and terminal with neon ANSI colors. Zero config, zero dependencies.
π¦ Installation
npm install neon-log --save-devπ Quick Start
Import
import { neonLog } from 'NeonLog';Use
neonLog.log('Hello World');
neonLog.info('User logged in', { id: 123 });
neonLog.warn('API deprecated');
neonLog.error('Error occurred', error);
neonLog.debug('Debug data', data);Override console (optional)
// In main.ts
import { neonLog } from 'NeonLog';
if (!environment.production) {
neonLog.overrideConsole();
}
// Now use console normally and it's colorful!
console.log('Message'); // β
Cyanπ¨ Colors
- LOG β Cyan π¦
- INFO β Purple πͺ
- WARN β Yellow π¨
- ERROR β Red π₯
- DEBUG β Green π©
Works in:
- β Browser DevTools
- β Terminal/Node.js
- β VS Code Console
- β Any modern terminal
π Examples
Angular Component
import { Component, OnInit } from '@angular/core';
import { neonLog } from 'NeonLog';
@Component({
selector: 'app-home',
template: '<h1>Home</h1>'
})
export class HomeComponent implements OnInit {
ngOnInit() {
neonLog.log('Component loaded');
}
}Angular Service
import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { neonLog } from 'NeonLog';
@Injectable({ providedIn: 'root' })
export class ApiService {
constructor(private http: HttpClient) {}
getUsers() {
neonLog.log('Fetching users...');
return this.http.get('/api/users').subscribe({
next: (data) => neonLog.info('β
Users loaded:', data),
error: (err) => neonLog.error('β Error:', err)
});
}
}Node.js/Express
import { neonLog } from 'NeonLog';
import express from 'express';
const app = express();
app.get('/api/users', (req, res) => {
neonLog.info('GET /api/users');
res.json([{ id: 1, name: 'John' }]);
});
app.listen(3000, () => {
neonLog.log('π Server running on port 3000');
});π― API
import { neonLog } from 'NeonLog';
neonLog.log(...args); // Cyan
neonLog.info(...args); // Purple
neonLog.warn(...args); // Yellow
neonLog.error(...args); // Red
neonLog.debug(...args); // Green
neonLog.overrideConsole(); // Replace all console.*()
neonLog.restore?.(); // Restore original consoleβ‘ Features
- β DevDependency only - Not in production bundle
- β Zero config - Import and use
- β No dependencies - Pure TypeScript
- β Cross-platform - Browser + Terminal
- β ANSI colors - True neon in terminal
- β CSS colors - Styled in DevTools
- β 1KB gzipped - Tiny footprint
π§ TypeScript Support
Full type safety:
type NeonLevel = 'log' | 'info' | 'warn' | 'error' | 'debug';
type NeonLogApi = typeof neonLog;π Performance
- Bundle Size: 1KB gzipped
- Load Time: <1ms
- Dependencies: 0
- Production Safe: Yes (devDependency)
π Browser Support
| Browser | Support | |---------|---------| | Chrome | β 90+ | | Firefox | β 88+ | | Safari | β 14+ | | Edge | β 90+ | | Terminal | β All |
π License
MIT Β© Swapnil Muley
π Links
- GitHub: neon-log
- Author: @gdswapnil11
Made with π for colorful debugging
Happy logging! π
