1.3.2 • Published 6 years ago

consoled v1.3.2

Weekly downloads
8
License
MIT
Repository
-
Last release
6 years ago

Consoled

An elegant console logger

  • What is it?
    • Consoled is a console logger made to provide detail, and simplicity with logging to the console. This includes color-coded logs, and ability to gain previous logs through the api. Example: Example The textual ouput is similar to what follows:
[3/6/2018 | 22:30:20]  Success: test
[3/6/2018 | 22:30:20]  test
[3/6/2018 | 22:30:20]  test
[3/6/2018 | 22:30:20]  Error: test
[3/6/2018 | 22:30:20]  Success: test
[3/6/2018 | 22:30:20]  Warn: test
[3/6/2018 | 22:30:20]  Error: test
[3/6/2018 | 22:30:20]  test

Which is in the format mm/dd/yyyy | hh:mm:ss {log} to give the timings to each log and make it simpler to use, and through a fairly-simple api.

How to use:

const consoleLogger = require('consoled');
const consoled = new consoleLogger.Console({catchErrors: true}); // Change 'catchErrors' to false to disable auto-error-catching.

//Console.log
consoled.log('MESSAGE');
/*Result (Color is grey)
[3/6/2018 | 22:30:20]  MESSAGE
*/

//Console.error
consoled.error('MESSAGE');
/*Result (Color is red)
[3/6/2018 | 22:30:20]  Error: MESSAGE
*/


//Console.warn
consoled.warn('MESSAGE');
/*Result (Color is yellow)
[3/6/2018 | 22:30:20]  Warn: MESSAGE
*/


//Console.info
consoled.info('MESSAGE');
/*Result (Color is bright blue)
[3/6/2018 | 22:30:20]  Info: MESSAGE
*/


//Console.dir
consoled.dir('MESSAGE');
/*Result (Color is blue)
[3/6/2018 | 22:30:20]  'test'
*/


//Console.success
consoled.success('MESSAGE');
/*Result (Color is green)
[3/6/2018 | 22:30:20]  Success: MESSAGE
*/

Getting previous logs:

consoled.getLogs();
//Returns logs in an array from first to last.

//Example result
[
	'[3/6/2018 | 22:30:20]  Success: test'
	'[3/6/2018 | 22:30:20]  test'
	'[3/6/2018 | 22:30:20]  test'
	'[3/6/2018 | 22:30:20]  Error: test'
]
1.3.2

6 years ago

1.2.2

6 years ago

1.2.1

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago