0.2.9 • Published 7 years ago

consolate v0.2.9

Weekly downloads
2
License
MIT
Repository
github
Last release
7 years ago

npm travis Dependency Status

consolate

Customize your Node.JS console like a dignitary.

Easily create intuitive log functions on the console objecteven override built-in console functions (error, info, warn, etc.) And while you're at it, feel free to easily define colors, prefixes, and bullets that can automatically animate cli-cursors.

examples/6-cicd-pipeline.js

Index

Examples

examples/1-simple-custom-method.js

var consolate = require('consolate')

consolate.init({
   arrow: {
      color: consolate.colors.cyan,
      prefix: {
         chars: '>>>>>----->',
         color: consolate.colors.lightCyan
      }
   }
})

console.arrow('My customized "arrow" log method!')

setTimeout(() => {
	console.arrow('Just think of the possibilities :-)')
}, 1500)

setTimeout(() => {
	console.arrow('And we haven\'t even scratched the surface.')
}, 3000)

setTimeout(() => {
	console.arrow('Okay, one more time before moving on.')
	console.log()
}, 4500)

examples/2-console-overrides-on-built-in-methods.js

examples/3-animated-and-static-bullets.js

examples/4-smart-log-argument-handling.js

examples/5-apollo-11.js

examples/6-cicd-pipeline.js

API Reference

consolate.init(options)

The initialization function that must be called to enable consolate.

Kind: static method of consolate

ParamTypeDescription
optionsconsolateOptions(or string) Options object with values that drive consolate behavior OR this parameter can be a filepath to options yaml file. If options is not provided, then a default options file consolate.yml will be searched for in working directory. See example #6 (examples/6-cicd-pipeline.js) for an example options yaml file.

consolate~colors : enum

Color representations of ANSI output text codes that consolate supports.

Kind: inner enum of consolate
Read only: true
Properties

NameTypeDefaultDescription
resetnumber0Not a color, per se...rather used to reset the active color back to default
defaultnumber39The default color configured by your terminal
blacknumber30
rednumber31
greennumber32
yellownumber33
bluenumber34
magentanumber35
cyannumber36
lightGraynumber37
darkGraynumber90
lightRednumber91
lightGreennumber92
lightYellownumber93
lightBluenumber94
lightMagentanumber95
lightCyannumber96
whitenumber97

consolate~restore

Restores the console object back to its native state by removing all consolate modifications.

Kind: inner constant of consolate

consolate~consolateOptions : Object

The consolate options object that defines output methods and their respective settings and/or overrides existing log methods and their behavior.

Kind: inner typedef of consolate
Properties

NameTypeDescription
keystringThe name of an output method (built-in or user-defined), which consolate will use to create a log method (of same name) on the console object.
valueoutputMethodSettingsThe settings to apply to the respecive output method.

consolate~outputMethodSettings : Object

An object that represents the settings for the output method that has the same name as this object's key.

Kind: inner typedef of consolate
Properties

NameTypeDescription
inPlacebooleanSpecifies that when a series of calls are made for this output method, all subsequent output will be rendered on the same line after the initial call—in effect overwriting the previous console output.
colorcolorsThe color to use for the output text.
prefixprefixThe prefix option (if any) to use for this output method.
bulletbulletThe bullet option (if any) to use for this output method.

consolate~prefix : Object

Specifies preferences (if any) for including an automatic prefix to all console output for an output method.

Kind: inner typedef of consolate
Properties

NameTypeDescription
charsstringOne or more characters to use as the prefix.
colorcolorsThe color to use for the prefix text.
leftPaddingnumberThe number of spaces to pad on the left side of the prefix.
rightPaddingnumberThe number of spaces to pad on the right side of the prefix.

consolate~bullet : Object

Specifies preferences (if any) for including an automatic left-aligned bullet to all console output for an output method.

Kind: inner typedef of consolate
Properties

NameTypeDescription
cliSpinnerstringFor an animated bullet, this is the spinner name to use per the cli-spinners library. Note: The animation will continue until a different output method is called, which will then overwrite the animation output, thus stopping and clearing it.
charsstringFor a static (non-animated) bullet, this is one or more characters to use as the bullet. This property is ignored if cliSpinner is specified.
colorcolorsThe color to use for the bullet text.
leftPaddingnumberThe number of spaces to pad on the left side of the bullet.
rightPaddingnumberThe number of spaces to pad on the right side of the bullet.
0.2.9

7 years ago

0.2.8

7 years ago

0.2.7

7 years ago

0.2.6

7 years ago

0.2.5

7 years ago

0.2.4

7 years ago

0.2.3

7 years ago

0.2.2

7 years ago

0.2.1

7 years ago

0.2.0

7 years ago

0.1.4

7 years ago

0.1.3

7 years ago

0.1.2

7 years ago

0.1.1

7 years ago

1.0.7

7 years ago

1.0.6

7 years ago

1.0.5

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.1

7 years ago

0.0.1

7 years ago