How to use the silly function from npmlog

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

77
78
79
80
81
82
83
84
85
86

function next (er, data, json, resp) {
  if (!er) er = errorResponse(name, resp)
  if (er) return cb(er)

  log.silly('addNameTag', 'next cb for', name, 'with tag', tag)

  engineFilter(data)
  if (data['dist-tags'] && data['dist-tags'][tag] &&
      data.versions[data['dist-tags'][tag]]) {
fork icon322
star icon0
watch icon2

+ 23 other calls in file

75
76
77
78
79
80
81
82
83
84

function tryGitProto (from, hostedInfo, cb) {
  var gitURL = hostedInfo.git()
  if (!gitURL) return tryHTTPS(from, hostedInfo, cb)

  log.silly('tryGitProto', 'attempting to clone', gitURL)
  tryClone(from, gitURL, true, function (er) {
    if (er) return tryHTTPS(from, hostedInfo, cb)

    cb.apply(this, arguments)
fork icon322
star icon0
watch icon2

+ 9 other calls in file

108
109
110
111
112
113
114
115
116
117
if (payload) {
    let hasFeatureFlag =
        (config.enabledFeatureFlags && config.enabledFeatureFlags.indexer) || (await db.redis.sismember(`feature:indexing`, entry.user.toString()));

    if (!hasFeatureFlag) {
        log.silly('Indexer', `Feature flag not set, skipping user=%s command=%s message=%s`, entry.user, entry.command, entry.message);
        return;
    } else {
        log.verbose('Indexer', `Feature flag set, processing user=%s command=%s message=%s`, entry.user, entry.command, entry.message);
    }
fork icon245
star icon0
watch icon54

259
260
261
262
263
264
265
266
267
268

## log\[level](prefix, message, ...)

For example,

* log.silly(prefix, message, ...)
* log.verbose(prefix, message, ...)
* log.info(prefix, message, ...)
* log.http(prefix, message, ...)
* log.warn(prefix, message, ...)
fork icon19
star icon22
watch icon13

+ 9 other calls in file

55
56
57
58
59
60
61
62
63
64
  return moveToArchive(placed, archiveRoot, groups).then(() => placed)
}).then(albums => {
  log.disableProgress()
  report(albums, staging)
  if (archive) reportArchived(albums)
  log.silly('unpack', 'tracker debugging', log.tracker.debug())
  log.verbose('removing', tmpdir)
  return rimraf(tmpdir).then(() => albums)
}).catch(error => {
  log.disableProgress()
fork icon1
star icon0
watch icon3

207
208
209
210
211
212
213
214
215
216
/**
 * @param {string} channel
 * @param {function(string): void} callback
 */
const subscribe = (channel, callback) => {
  log.silly(`Adding listener for ${channel}`);

  subs[channel] = subs[channel] || [];

  if (subs[channel].length === 0) {
fork icon0
star icon551
watch icon27

+ 2 other calls in file

99
100
101
102
103
104
105
106
107
108
    return JSON.parse(json);
  } catch (err) {
    if (req.accountId) {
      log.warn(req.requestId, `Error parsing message from user ${req.accountId}: ${err}`);
    } else {
      log.silly(req.requestId, `Error parsing message from ${req.remoteAddress}: ${err}`);
    }
    return null;
  }
};
fork icon0
star icon4
watch icon2

+ 3 other calls in file

54
55
56
57
58
59
60
61
62
log.info(`Normal exit: event: ${event}`);
if(l7mp && l7mp.cleanup)
    l7mp.cleanup.forEach(file => {
        try {
            fs.accessSync(file);
            log.silly(`Cleanup: removing "${file}"`);
            fs.unlinkSync(file);
        } catch(e) { /* NOP */ }
    })
fork icon7
star icon15
watch icon4

162
163
164
165
166
167
168
169
170
171
            .usage('Usage: $0 [options] inspect [file [dir...]]')
            .demand(2)
            .argv

const things = argv._.slice(1)
log.silly('inspect', 'argv', argv)
log.silly('inspect', 'things', things)

log.enableProgress()
Promise.map(things, f => {
fork icon1
star icon0
watch icon3

+ 7 other calls in file

122
123
124
125
126
127
128
129
130
131
let lockId = 'gs.' + hash.toString('base64');
let storeLock;

let attachmentCallback = (...args) => {
    if (storeLock) {
        log.silly('GridStore', '[%s] UNLOCK lock=%s status=%s', instance, lockId, storeLock.success ? 'locked' : 'empty');
        if (storeLock.success) {
            this.lock.releaseLock(storeLock, () => {
                if (returned) {
                    // might be already finished if retrying after delay
fork icon245
star icon0
watch icon0

228
229
230
231
232
233
234
235
236
237

/**
 * @param {string} channel
 */
const unsubscribe = (channel, callback) => {
  log.silly(`Removing listener for ${channel}`);

  if (!subs[channel]) {
    return;
  }
fork icon2
star icon4
watch icon2

+ 279 other calls in file

636
637
638
639
640
641
642
643
644
645
  output(event, encodedPayload);
};

// Only send local-only statuses to logged-in users
if (event === 'update' && payload.local_only && !(req.accountId && allowLocalOnly)) {
  log.silly(req.requestId, `Message ${payload.id} filtered because it was local-only`);
  return;
}

// Only messages that may require filtering are statuses, since notifications
fork icon0
star icon2
watch icon1

+ 62 other calls in file

89
90
91
92
93
94
95
96
97
98
    cleaned.token = auth.token
    cleaned.auth = auth.auth
    cleaned.username = auth.username
    cleaned.password = auth.password
  } else {
    log.silly('scopeAuth', uri, "doesn't share host with registry", registry)
  }
}

return cleaned
fork icon0
star icon1
watch icon1

+ 47 other calls in file

143
144
145
146
147
148
149
150
151
152
results = results.reduce(reducer, {})
var retval = results

if (args.length === 1 && args[0] === '') {
  retval = cleanBlanks(retval)
  log.silly('cleanup', retval)
}

if (error || silent) cb(error, retval)
else printData(results, data._id, cb.bind(null, error, retval))
fork icon0
star icon1
watch icon1

+ 5 other calls in file

26
27
28
29
30
31
32
33
34
35
if (!cb) {
  cb = gently
  gently = false
}

log.silly(
  'gentlyRm',
  target,
  'is being', gently ? 'gently removed' : 'purged',
  base ? 'from base ' + base : ''
fork icon0
star icon1
watch icon1

+ 44 other calls in file

150
151
152
153
154
155
156
157
158
159
  er = null
  response = { statusCode: 304 }
}

if (response) {
  log.silly('get', 'cb', [response.statusCode, response.headers])
  if (response.statusCode === 304 && (etag || lastModified)) {
    remoteData = data
    log.verbose(etag ? 'etag' : 'lastModified', uri + ' from cache')
  }
fork icon0
star icon1
watch icon1

+ 4 other calls in file

274
275
276
277
278
279
280
281
282
283
cb = afterAdd(cb)

realizePackageSpecifier(spec, where, function (err, p) {
  if (err) return cb(err)

  log.silly('cache add', 'parsed spec', p)

  switch (p.type) {
    case 'local':
    case 'directory':
fork icon0
star icon1
watch icon1

+ 19 other calls in file

29
30
31
32
33
34
35
36
37
38
39


function andLogAndFinish (spec, tracker, done) {
  validate('SF', [spec, done])
  return function (er, pkg) {
    if (er) {
      log.silly('fetchPackageMetaData', 'error for ' + spec, er)
      if (tracker) tracker.finish()
    }
    return done(er, pkg)
  }
fork icon0
star icon1
watch icon1

+ 69 other calls in file

113
114
115
116
117
118
119
120
121
122

if (packageLifecycle) {
  // define this here so it's available to all scripts.
  env.npm_lifecycle_script = pkg.scripts[stage]
} else {
  log.silly('lifecycle', logid(pkg, stage), 'no script for ' + stage + ', continuing')
}

function done (er) {
  if (er) {
fork icon0
star icon1
watch icon0

+ 2 other calls in file

27
28
29
30
31
32
33
34
35
36
    'Press ^C at any time to quit.'
  ].join('\n'))
}
initJson(dir, initFile, npm.config, noProgressTillDone(function (er, data) {
  log.resume()
  log.silly('package data', data)
  if (er && er.message === 'canceled') {
    log.warn('init', 'canceled')
    return cb(null, data)
  }
fork icon0
star icon1
watch icon0