Package Exports
- squeak
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (squeak) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
squeak 
A tiny stream log
Install
$ npm install --save squeak
Usage
var Squeak = require('squeak');
var log = new Squeak({ separator: ' ' });
log.type('success', { color: 'green', prefix: '✔' });
log.type('warn', { color: 'yellow', prefix: '⚠' });
log.type('error', { color: 'red', prefix: '✖' }, function () {
log.end();
process.exit(1);
});
log.success('this is a success message');
log.warn('this is a warning');
log.error(new Error('this is an error').stack);
/*
✔ this is a success message
⚠ this is a warning
✖ this is an error
at ChildProcess.exithandler (child_process.js:648:15)
at ChildProcess.emit (events.js:98:17)
*/
API
new Squeak(options)
Type: Object
Creates a new Squeak
instance with options.
.write(message)
Writes to options.stream
, using process.stderr
by default.
.type(type, options, callback)
Adds a type.
type
Type: String
The name of the type. Will be used as prefix
by default.
options
Type: Object
Customize your type with a color
and a prefix
.
color
: Sets the prefix color. Supported colors can be found here.prefix
: Sets thetype
prefix. Usestype
as default.
cb
Type: Function
An optional callback to be called when the type
is called.
.emit(event, data)
Emits an event.
.end()
Writes a newline.
Options
indent
Type: Number
Default: 2
Sets the indentation.
separator
Type: String
Default: :
Customize the separator between the prefix
and the message.
stream
Type: Stream
Default: process.stderr
Which stream
to write to.
License
MIT © Kevin Mårtensson