Argon logger 
Argon logger is a simple console utility with options to enable/disable logs for any environment. Argon logger extends the existing console API, there it works the same as console.log
but with more control and flexibility. Additionally, it doesn't throw any linting error (unless someone decides to create a rule for logger.log
too).
Installation
npm i argon-logger
How it works?
Argon logger is simple to use.
Without configuration
import Logger from 'argon-logger';
const logger = new Logger();
logger.log('Hello');
logger.warn('This is a warning');
logger.error('This is an error');
logger.debug('This is a debug message');
...
By default argon logger enables log statements for localhost URLs or URLs containing debug
as a search parameter. We can change this behavior by providing a configuration.
With configuration
const logger = new Logger({
allowedHostnames: ['google.com'],
allowedQueryStringParameters: ['debug=true'],
allowedPorts: [],
test: () => { ... },
disable: false
});
logger.log('Hello');
logger.warn('This is a warning');
...
Disclaimer
Argon logger doesn't have any major releases yet. It means it has potential to break in few scenarios. We need your contribution to make it better. Please email at contactsachinsingh@gmail.com if you want to become a contributor.