How to use the debuglog function from util

Find comprehensive JavaScript util.debuglog code examples handpicked from public code repositorys.

15
16
17
18
19
20
21
22
23
24
25
26
const detectiveSass = require('detective-sass');
const detectiveScss = require('detective-scss');
const detectiveStylus = require('detective-stylus');
const detectiveTypeScript = require('detective-typescript');


const debug = debuglog('precinct');
// eslint-disable-next-line n/no-deprecated-api
const natives = process.binding('natives');


/**
fork icon39
star icon175
watch icon2

+ 3 other calls in file

401
402
403
404
405
406
407
408
409
410

`console.error` 的过时前身。


<div id="debuglog" class="anchor"></div>
## util.debuglog(section)

* `section` {String} 进行调试的程序部分

* 返回:{Function} 日志函数
fork icon21
star icon99
watch icon2

+ 3 other calls in file

21
22
23
24
25
26
27
28
29
30
'use strict';

const net = require('net');
const util = require('util');
const EventEmitter = require('events');
const debug = util.debuglog('http');
const { async_id_symbol } = process.binding('async_wrap');
const { nextTick } = require('internal/process/next_tick');

// New Agent code.
fork icon19
star icon213
watch icon17

214
215
216
217
218
219
220
221
222
223


/*<replacement>*/
var debug = require('util');
if (debug && debug.debuglog) {
  debug = debug.debuglog('stream');
} else {
  debug = function () {};
}
/*</replacement>*/
fork icon17
star icon102
watch icon33

1
2
3
4
5
6
7
8
9
10
11
12
13


const { debuglog } = require('util');
const Walker = require('node-source-walk');
const sass = require('gonzales-pe');


const debug = debuglog('detective-sass');


/**
 * Extract the @import statements from a given sass file's content
 *
fork icon5
star icon5
watch icon2

74
75
76
77
78
79
80
81
82
83
  return (!handle || typeof handle.getAsyncId !== 'function') ?
    newUid() : handle.getAsyncId();
}


const debug = util.debuglog('net');

function isPipeName(s) {
  return typeof s === 'string' && toNumber(s) === false;
}
fork icon0
star icon3
watch icon1

82
83
84
85
86
87
88
89
90
environment variable, then the returned function operates similar to
[`console.error()`][]. If not, then the returned function is a no-op.

```js
const util = require('util');
const debuglog = util.debuglog('foo');

debuglog('hello from foo [%d]', 123);
```
fork icon0
star icon3
watch icon3

+ 3 other calls in file

54
55
56
57
58
59
60
61
62
63
  if (type === 'TCP') return createTCP();
  throw new TypeError('Unsupported fd type: ' + type);
}


var debug = util.debuglog('net');

function isPipeName(s) {
  return util.isString(s) && toNumber(s) === false;
}
fork icon0
star icon11
watch icon3

29
30
31
32
33
34
35
36
37
var tls_wrap = process.binding('tls_wrap');

// Lazy load
var tls_legacy;

var debug = util.debuglog('tls');

function onhandshakestart() {
  debug('onhandshakestart');
fork icon0
star icon2
watch icon2

31
32
33
34
35
36
37
38
39
  _connectionListener,
  kServerResponse
} = require('_http_server');
const { ClientRequest } = require('_http_client');
const { inherits } = util;
const debug = util.debuglog('https');
const { URL, urlToOptions, searchParamsSymbol } = require('internal/url');
const { IncomingMessage, ServerResponse } = require('http');
const { kIncomingMessage } = require('_http_common');
fork icon0
star icon1
watch icon2

16
17
18
19
20
21
22
23
24
25
26
27
const crypto = require("crypto");
const util = require("util");
const url = require("url");
const fetch = require("node-fetch");
const qs = require("querystring");
const debuglog = util.debuglog('signer');




/**
 * 不参与加签过程的 header key
fork icon0
star icon0
watch icon1

5421
5422
5423
5424
5425
5426
5427
5428
5429
5430
5431
5432
var debugUtil = require('util');


var debug;


if (debugUtil && debugUtil.debuglog) {
  debug = debugUtil.debuglog('stream');
} else {
  debug = function debug() {};
}
/*</replacement>*/
fork icon0
star icon0
watch icon1