UNPKG

1.52 kBJavaScriptView Raw
1'use strict';
2
3var format = require('util').format
4 , colors = require('ansicolors')
5 , debug = !!process.env.REPLPAD_DEBUG;
6
7module.exports = {
8 silly: function () {
9 if (!debug) return;
10 this.output.write(colors.brightBlack('SILL ') + colors.brightBlack(format.apply(this, arguments)) + '\n');
11 }
12 , info: function () {
13 this.output.write(colors.green('INFO ') + colors.brightBlack(format.apply(this, arguments)) + '\n');
14 }
15 , warn: function () {
16 this.output.write(colors.blue('WARN ') + format.apply(this, arguments) + '\n');
17 }
18 , error: function () {
19 this.output.write(colors.red('ERR! '), format.apply(this, arguments) + '\n');
20 }
21 , print: function () {
22 this.output.write(colors.brightBlack(format.apply(this, arguments)) + '\n');
23 }
24 , sillyln: function () {
25 if (!debug) return;
26 this.silly.apply(this, arguments);
27 this.displayPrompt();
28 }
29 , infoln: function () {
30 this.info.apply(this, arguments);
31 this.displayPrompt();
32 }
33 , warnln: function () {
34 this.warn.apply(this, arguments);
35 this.displayPrompt();
36 }
37 , errorln: function () {
38 this.error.apply(this, arguments);
39 this.displayPrompt();
40 }
41 , println: function () {
42 this.print.apply(this, arguments);
43 this.displayPrompt();
44 }
45 , displayPrompt: function () {
46 if (!this.repl) return;
47 this.repl.displayPrompt();
48 }
49 // will be set by repreprep when initialized
50 , repl: undefined
51 , ouput: undefined
52};