How to use the debug function from loglevel

Find comprehensive JavaScript loglevel.debug code examples handpicked from public code repositorys.

16
17
18
19
20
21
22
23
24
25
* Filter logging by level (all the above or 'silent'), so you can disable all but error logging in production, and then run log.setLevel("trace") in your console to turn it all back on for a furious debugging session
* Single file, no dependencies, weighs in at 1.1KB minified and gzipped

### Effective

* Log methods gracefully fall back to simpler console logging methods if more specific ones aren't available: so calls to log.debug() go to console.debug() if possible, or console.log() if not
* Logging calls still succeed even if there's no console object at all, so your site doesn't break when people visit with old browsers that don't support the console object (here's looking at you IE) and similar
* This then comes together giving a consistent reliable API that works in every JavaScript environment with a console available, and never breaks anything anywhere else

### Convenient
fork icon170
star icon0
watch icon4

+ 9 other calls in file

65
66
67
68
69
70
71
72
73
/**
 * @param {ScanRequest} request
 * @returns {string}
 */
scan(request) {
  log.debug(LogFormatter.format().full(request));
  const params = request.params;
  const cmdBuilder = new CommandBuilder(this.config.scanimage);
  cmdBuilder.arg('-d', params.deviceId);
fork icon114
star icon466
watch icon6

+ 46 other calls in file

38
39
40
41
42
43
44
45
46
47

async function start () {
  log.debug('Badger initializing...')
  const initState = await loadStateFromPersistence()
  await setupController(initState)
  log.debug('Badger initialization complete.')
}

//
// State and Persistence
fork icon24
star icon23
watch icon4

+ 5 other calls in file

112
113
114
115
116
117
118
119
120
121

/**
 * Stop client webcam video stream.
 */
stopStreaming() {
    log.debug('removed local stream');
    this.instance.removeLocalStream(this.localStream);
    this.localStream = null;
    this.streaming = false;
}
fork icon18
star icon46
watch icon15

+ 3 other calls in file

12
13
14
15
16
17
18

const port = process.env.NODE_PORT || 3006;

app.listen(port, () => {
  log.info(`listening on port:${port}`);
  log.debug('debug log level!');
});
fork icon8
star icon1
watch icon8

350
351
352
353
354
355
356
357
358
359
    sanitizedData.channel = sanitizedData.channel.id;
  }
  if (sanitizedData.pokemon && sanitizedData.pokemon.name) {
    sanitizedData.pokemon = sanitizedData.pokemon.name;
  }
  log.debug(sanitizedData);
  newImage.write(path.join(__dirname, this.imagePath, `${id}.png`));
}

if (data) {
fork icon20
star icon15
watch icon0

+ 7 other calls in file

366
367
368
369
370
371
372
373
374
375
376
377
378


app.post('/VolumeDriver.Get', function (req, res) {
  var volume_name = req.body.Name
  var host_mountpoint = path.join(host_volume_path, volume_name)


  log.debug(`/VolumeDriver.Get: ${volume_name}`)


  // If the volume is the root volume
  if (volume_name == root_volume_name) {
    // If the root volume is mounted
fork icon15
star icon29
watch icon5

+ 636 other calls in file

271
272
273
274
275
276
277
278
279

/*
 * effect to load page when mounted
 */
useEffect(() => {
  log.debug('verify mounted:');
  // update filter right away to prevent non-Filter type objects loading
  document.title = `Verify - ${documentTitle}`;
}, []);
fork icon151
star icon24
watch icon10

+ 54 other calls in file

67
68
69
70
71
72
73
74
75
76

/**
 * @returns {Promise.<FileInfo>}
 */
async finish() {
  log.debug(`Post processing: ${this.pipeline.description}`);
  let files = (await this.listFiles()).filter(f => f.extension === '.tif');

  // Update preview with the first image (pre filter)
  await this.updatePreview(files[0].name);
fork icon113
star icon463
watch icon5

+ 14 other calls in file

1121
1122
1123
1124
1125
1126
1127
1128
1129
1130

} else {
    tabvn = me.vnRezTab(winvn.node_id);

    if(!tabvn.node_id) {
        log.debug({"Could not create record for ctab":ctab, winvn});
        me.eraseTab(tabvn);
        return false;
    }
    if(!me.markTabAsOpen(tabvn.val, ctab)) {
fork icon27
star icon150
watch icon15

+ 65 other calls in file

81
82
83
84
85
86
87
88
89
90


  if (whereIns.length) {
    arr.push(`whereIns=${JSON.stringify(whereIns)}`);
  }


  // log.debug('makeQueryString 2 ----->', arr);
  return arr.join('&');
};
fork icon151
star icon24
watch icon10

+ 7 other calls in file

101
102
103
104
105
106
107
108
109
110
111
  }
});


app.get("/redirect", async (req, res) => {
  try {
    log.debug(`Got redirect: [${getRequestFullUrl(req)}]`);
    await session
      .handleIncomingRedirect(getRequestFullUrl(req))
      .then((info) => {
        log.info(`Got INFO: [${JSON.stringify(info, null, 2)}]`);
fork icon34
star icon52
watch icon12

285
286
287
288
289
290
291
292
293
294
        curr = scanner.next();
        continue;
}

if (curr.value === 'HEADER') {
        log.debug('> HEADER');
        dxf.header = parseHeader();
        log.debug('<');
} else if (curr.value === 'BLOCKS') {
        log.debug('> BLOCKS');
fork icon7
star icon8
watch icon3

+ 21 other calls in file

120
121
122
123
124
125
126
127
128
        retries: errorRetries,
        minTimeout: errorRetriesTimeout * 1000, // delay between retries in ms
        randomize: false,
        onRetry: error => {
            console.log(error)
            logger.debug(error.message)
        }
    }
);
fork icon6
star icon3
watch icon1

+ 15 other calls in file

24
25
26
27
28
29
30
31
32
33
 * @param channel
 * @return {Promise<void>}
 */
async function processBlockRange(begin, end, channel) {
    for (let block = begin; block <= end; block++) {
        log.debug(`Block ${block} started`)
        let count = await web3.eth.getBlockTransactionCount(block)
        for (let i = 0; i < count; i++) {
            let transaction = await web3.eth.getTransactionFromBlock(block, i)
            let address = transaction.creates
fork icon5
star icon21
watch icon3

+ 7 other calls in file

393
394
395
396
397
398
399
400
401
402
    // setCwSettingsInUIInput();
    // setCwSettingsInUILabels();
}

saveSettings() {
    log.debug("save settings", this.settings);
    localStorage.setItem(STORAGE_KEY_SETTINGS, JSON.stringify(this.settings));
}

getSavedResults() {
fork icon3
star icon10
watch icon0

+ 220 other calls in file

34
35
36
37
38
39
40
41
42
43
44
45
46
47
}, false);


class M32Main {


    constructor() {
        log.debug("initM32");


        this.mode = MODE_CW_GENERATOR;


        let m32Storage = new M32Storage();
fork icon3
star icon10
watch icon0

+ 3 other calls in file

15
16
17
18
19
20
21
22
23
24
logger: {
    warn: logger.warn,
    info: logger.info,
    error: logger.error,
    trace: logger.trace,
    debug: logger.debug
},
db: {
    uri: process.env.MONGODB_URL
},
fork icon1
star icon2
watch icon0

+ 5 other calls in file

324
325
326
327
328
329
330
331
332
333
      hostname: this.ip,
      port: this.port,
      path: '/send?raw=' + packetB64,
      agent: false
    }
    http.get(options, function (response){ log.debug('GET ' + url) }).on('error',
      function (error){ log.debug('HTTP error: ' + error.message) }
    );
}

fork icon2
star icon1
watch icon0

+ 15 other calls in file

47
48
49
50
51
52
53
54
55
56

//var web3 = new Web3(inpageProvider)


//web3.setProvider = function () {
//  log.debug('Smallet - overrode web3.setProvider')
//}
log.debug('Smallet - injected web3')

//setupDappAutoReload(web3, inpageProvider.publicConfigStore)
fork icon1
star icon0
watch icon0