1.0.3 • Published 3 months ago

console-custom-tag v1.0.3

Weekly downloads
-
License
MIT
Repository
-
Last release
3 months ago

console-tag

Easier to see personal log in browser.

Installation

npm i -S console-tag

Usage

You need to install it before using it. tag config is required.

        import consoleTag from '/dist/console-tag.bundle.js';
        consoleTag.install({
            enable: true, // false or true
            tag: {
                'test': {
                    tag: {
                        name: '[test-tag]',
                        style: 'color:white;background-color:#ecad9e;border-radius:4px;padding:2px 4px;font-size:12px;'
                    },
                    hook: () => {
                        console.log("I am a hook")
                    }
                }
            }
        });
        console.test('tag sth')

Tag Configuration supports customization.You can config your nickname and colorful tag.

        consoleTag.install({
            enable: true, // false or true
            tag: {
                'custom-name': { // terminate you want
                    tag: {
                        name: '[test-tag]', // tag show in console
                        style: 'color:white;background-color:#ecad9e;border-radius:4px;padding:2px 4px;font-size:12px;'
                    },
                    hook: () => {
                        console.log("I am a hook")
                    }
                }
            }
        });

params

install(config)
paramstyperequireddescription
enablebooleanfalseIt will take effect when the value is false, and supports configuration according to the environment.Example: dev debugging environment takes effect, production not install({ enable: env === 'dev' ? true : false })
tagObjecttrueConfig commands what you want
'customName'Objecttrue'customName' is the command u want. console[customName]
tagObjecttrueTag style config
nameStringtrueTag context
styleStringtrueTag style
hookFunctionfalseHook function will be called before custom command.
1.0.3

3 months ago

1.0.2

3 months ago

1.0.1

3 months ago

1.0.0

3 months ago