Skip to content

Add Custom Console In your webapp like codepen codesandbox

License

Notifications You must be signed in to change notification settings

vakhariaheet/custom-js-console

Repository files navigation

Custom JS Console

create your own custom console just like codepen codesandbox etc

Node Version License Min Size build semantic-release code style: prettier

Installation

npm install custom-js-console --save
yarn add custom-js-console
<!--Minified Version-->
<script src="https://unpkg.com/custom-js-console"></script>
<!-- UnMinified Version-->
<script src="https://unpkg.com/custom-js-console/dist/index.umd.js"></script>

Import

import customConsole from 'custom-js-console';
// Common JS
const customConsole = require('custom-js-console');
customConsole;

Note

If customConsole is initialized twice then first one will be overridden

Usage

const { options, originalConsole } = new customConsole({
	log: (message, ...optionalParams) => {
		// Called When console.log is called
		alert('Console.log Called');
	},
	warn: (message, ...optionalParams) => {
		// Called When console.warn is called
		alert('Console.warn Called');
	},
	error: (message, ...optionalParams) => {
		// Called When console.error is called
		alert('Console.error Called');
	},
	info: (message, ...optionalParams) => {
		// Called When console.info is called
		alert('Console.info Called');
	},
	table: (tabularData, properties) => {
		// Called When console.table is called
		alert('Console.table Called');
		originalConsole.log(tabularData, properties); // Original Console
	},
});

Contributing

See CONTRIBUTING.md.

Bugs and Issues

If you encounter any bugs or issues, feel free to open an issue at github or email me to [email protected]. I also always like to hear from you, if you’re using my code.

About

Add Custom Console In your webapp like codepen codesandbox

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published