Namespace

Namespaces helps you track your console. It's concatenated to the prefix to label what is being printed to the console. There are multiple ways to enable the namespace feature.

Instantiated Console

const Console = require('tampered-console');
new Console('namespace').log(args);

Global Console

Individual Namespace

There is an option where the global console can be labeled individually. If this is enabled, the console method will have to be invoked twice as it returns a function. First for the namespace and next for the arguments.

index.js
const Console = require('tampered-console');
Console.globalConsole({ namespace: true });
app.js
console.log('namespace')(args);

Uniform Namespace

Uniform namespace labels your console every time it logs.

There are two ways to achieve a uniform namespace. First is to pass the namespace as string in the globalConsoleor pass the namespace as namespace property value.

const Console = require('tampered-console');
Console.globalConsole('namespace');
const Console = require('tampered-console');
Console.globalConsole({ namespace: 'namespace' });

Last updated