How to use the enableColor function from npmlog

Find comprehensive JavaScript npmlog.enableColor code examples handpicked from public code repositorys.

230
231
232
233
234
235
236
237
238

* {Stream} Default: `process.stderr`

The stream where output is written.

## log.enableColor()

Force colors to be used on all messages, regardless of the output
stream.
fork icon19
star icon22
watch icon13

+ 9 other calls in file

39
40
41
42
43
44
45
46
47
48
  log.level = config.get('loglevel')

log.heading = config.get('heading') || 'npm'

if (enableColorStderr)
  log.enableColor()
else
  log.disableColor()

if (config.get('unicode'))
fork icon0
star icon1
watch icon0

0
1
2
3
4
5
6
7
8
9
const log = require('npmlog');

const setupLogger = (logLevel) => {
  log.level = logLevel || 'info';
  log.stream = process.stdout;
  log.enableColor();
  log.info('Dextrose Logger', `Log level is ${log.level}`);
};

export default {
fork icon1
star icon24
watch icon18