konx
v1.0.1
Published
A flexible console logging utility with debug levels for production
Downloads
6
Maintainers
Readme
konx
A flexible console logging utility with debug levels for JavaScript applications.
Installation
npm install konx
Usage
const createKonsole = require('konsole');
// Create a konx instance
const konx = createKonsole();
// Use konx methods
konx.log('This is a regular log message');
konx.error('This is an error message');
konx.dev1('This is a level 1 debug message');
konx.dev2('This is a level 2 debug message');
konx.dev3('This is a level 3 debug message');
// Configure debug levels in localStorage
localStorage.setItem('dev', 'true'); // Enable all logging
localStorage.setItem('dev', '1,2'); // Enable logging for levels 1 and 2
localStorage.removeItem('dev'); // Disable all logging
API
konx.log()
,konx.error()
, etc.: Regular console methods (level 1)konx.dev1()
,konx.dev2()
, etc.: Debug methods for specific levels
Configuration
Set localStorage.dev
to control logging:
'true'
: Enable all logging'1,2,3'
: Enable specific debug levelsnull
or not set: Disable all logging
License
MIT