var debug = require('debug')('express-locallibrary-tutorial:server'); I'd like to know mean of it. I'd like to know mean of it

huangapple go评论89阅读模式
英文:

var debug = require('debug')('express-locallibrary-tutorial:server'); I'd like to know mean of it. I'd like to know mean of it

问题

I'm learning Express for backend development.
So I built express-locallibrary-tutorial from GitHub.
But I don't understand
var debug = require('debug')('express-locallibrary-tutorial:server');
So I hope someone will expand me in detail about it.

I found "debug": "~2.6.9" as dependency in package.json.
So I understood
var debug = require('debug')
as dependency.
But I can't understand
var debug = require('debug')('express-locallibrary-tutorial:server')

英文:

I'm learning Express for backend development.
So I built express-locallibrary-tutorial from GitHub.
But I don't understand

var debug = require('debug')('express-locallibrary-tutorial:server');

So I hope someone will expand me in detail about it.

I found "debug": "~2.6.9" as dependency in package.json.
So I understood

var debug = require('debug')

as dependency.
But I can't understand

var debug = require('debug')('express-locallibrary-tutorial:server')

答案1

得分: 0

require('debug') 返回一个函数。这是调用该函数并将 debug 设置为它返回的值。等效于:

var debug_func = require('debug');
var debug = debug_func('express-locallibrary-tutorial:server');
英文:

require('debug') returns a function. This is calling that function and setting debug to the value it returns. It's equivalent to:

var debug_func = require('debug');
var debug = debug_func('express-locallibrary-tutorial:server');

huangapple
  • 本文由 发表于 2023年3月3日 23:37:31
  • 转载请务必保留本文链接:https://go.coder-hub.com/75629090.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定