finki-main
main
|
Last change
on this file since 81bc7da was 81bc7da, checked in by Klimentina Efremova <klimentina08642@…>, 3 months ago |
|
Initial commit
|
-
Property mode
set to
100644
|
|
File size:
627 bytes
|
| Rev | Line | |
|---|
| [81bc7da] | 1 | const levels = {
|
|---|
| 2 | silent: 0,
|
|---|
| 3 | error: 1,
|
|---|
| 4 | warn: 2,
|
|---|
| 5 | notice: 3,
|
|---|
| 6 | http: 4,
|
|---|
| 7 | timing: 5,
|
|---|
| 8 | info: 6,
|
|---|
| 9 | verbose: 7,
|
|---|
| 10 | silly: 8
|
|---|
| 11 | }
|
|---|
| 12 |
|
|---|
| 13 | module.exports = function (rc, env) {
|
|---|
| 14 | const level = rc.verbose
|
|---|
| 15 | ? 'verbose'
|
|---|
| 16 | : env.npm_config_loglevel || 'notice'
|
|---|
| 17 |
|
|---|
| 18 | const logAtLevel = function (messageLevel) {
|
|---|
| 19 | return function (...args) {
|
|---|
| 20 | if (levels[messageLevel] <= levels[level]) {
|
|---|
| 21 | console.error(`prebuild-install ${messageLevel} ${args.join(' ')}`)
|
|---|
| 22 | }
|
|---|
| 23 | }
|
|---|
| 24 | }
|
|---|
| 25 |
|
|---|
| 26 | return {
|
|---|
| 27 | error: logAtLevel('error'),
|
|---|
| 28 | warn: logAtLevel('warn'),
|
|---|
| 29 | http: logAtLevel('http'),
|
|---|
| 30 | info: logAtLevel('info'),
|
|---|
| 31 | level
|
|---|
| 32 | }
|
|---|
| 33 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.