1.4.3 • Published 24 days ago

console-wizard v1.4.3

Weekly downloads
-
License
MIT
Repository
github
Last release
24 days ago

Contents


Installation

npm install console-wizard --save
# or
yarn add console-wizard

Usage

import { logger } from 'console-wizard';

logger.error('Invalid syntax for database query!');
logger.info('Environment: Development');
logger.success('All tests passed!');
logger.warn('getDataById() has been depreciated! Use getData instead()');

Output:

image

Tables:

import { logger } from 'console-wizard';

logger.table([
  { name: 'David Lesten', age: 24, occupation: 'Full stack Developer' },
  { name: 'Mark Nimz', age: 32, occupation: 'Backend Developer' },
  { name: 'Lucy Haris', age: 28, occupation: 'Data Scientist' },
  { name: 'Joe Lewis', age: 23, occupation: 'UI/UX Designer' },
  { name: 'Robert Wilson', age: 19, occupation: 'Frontend Developer' },
]);

Output:

tables

Configuration

You can set up the user default configuration by:

import { setWizardConfig } from 'console-wizard';

setWizardConfig({
  /* Weather to include timestamp in the log */
  includeTimestamp: true,

  /* Weather to include status in the log (Ex. "ERROR", "WARN" etc) */
  includeStatus: true,
});

The above configuration would apply for all the loggers in the codebase, except for the ones that have their own configuration (more on that here: #Configuring each log statement)

Note that configuring Console Wizard is completely optional! It ships with the above configuration by default!

Configuring each log statement

Additionally, you can also configure each log statement. For example

import { logger } from 'console-wizard';

logger.info('New GET request on /v1/users', {
  includeTimestamp: false,
});

If both user default configuration (using WizardConfig class) and inline configuration are provided, the configurations are combined with inline one being superior.

Author

License

MIT License

1.4.3

24 days ago

1.4.2

10 months ago

1.4.1

10 months ago

1.4.0

10 months ago

1.3.2

11 months ago

1.3.1

11 months ago

1.3.0

11 months ago

1.2.0

11 months ago

1.1.0

11 months ago

1.0.0

11 months ago

0.0.1

11 months ago