Skip to content
This repository was archived by the owner on Feb 12, 2024. It is now read-only.

Commit d2726fb

Browse files
author
Alan Shaw
authored
refactor: normalise debug logging prefix from jsipfs to just ipfs (#1911)
Shorter prefix ftw, MFS already uses "ipfs". Hooray \o/ License: MIT Signed-off-by: Alan Shaw <[email protected]>
1 parent 87893a6 commit d2726fb

25 files changed

+50
-50
lines changed

src/core/components/dht.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ const nextTick = require('async/nextTick')
1111
const errcode = require('err-code')
1212

1313
const debug = require('debug')
14-
const log = debug('jsipfs:dht')
15-
log.error = debug('jsipfs:dht:error')
14+
const log = debug('ipfs:dht')
15+
log.error = debug('ipfs:dht:error')
1616

1717
module.exports = (self) => {
1818
return {

src/core/components/name-pubsub.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ const promisify = require('promisify-es6')
66

77
const IpnsPubsubDatastore = require('../ipns/routing/pubsub-datastore')
88

9-
const log = debug('jsipfs:name-pubsub')
10-
log.error = debug('jsipfs:name-pubsub:error')
9+
const log = debug('ipfs:name-pubsub')
10+
log.error = debug('ipfs:name-pubsub:error')
1111

1212
// Is pubsub enabled
1313
const isNamePubsubEnabled = (node) => {

src/core/components/name.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ const human = require('human-to-milliseconds')
88
const crypto = require('libp2p-crypto')
99
const errcode = require('err-code')
1010

11-
const log = debug('jsipfs:name')
12-
log.error = debug('jsipfs:name:error')
11+
const log = debug('ipfs:name')
12+
log.error = debug('ipfs:name:error')
1313

1414
const namePubsub = require('./name-pubsub')
1515
const utils = require('../utils')

src/core/components/ping-pull-stream.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ const PeerId = require('peer-id')
66
const pull = require('pull-stream')
77
const Pushable = require('pull-pushable')
88

9-
const log = debug('jsipfs:pingPullStream')
10-
log.error = debug('jsipfs:pingPullStream:error')
9+
const log = debug('ipfs:pingPullStream')
10+
log.error = debug('ipfs:pingPullStream:error')
1111

1212
module.exports = function pingPullStream (self) {
1313
return (peerId, opts) => {

src/core/index.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,8 @@ class IPFS extends EventEmitter {
9595
}
9696

9797
// IPFS utils
98-
this.log = debug('jsipfs')
99-
this.log.err = debug('jsipfs:err')
98+
this.log = debug('ipfs')
99+
this.log.err = debug('ipfs:err')
100100

101101
// IPFS Core Internals
102102
// this._repo - assigned above

src/core/ipns/index.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ const Receptacle = require('receptacle')
66

77
const errcode = require('err-code')
88
const debug = require('debug')
9-
const log = debug('jsipfs:ipns')
10-
log.error = debug('jsipfs:ipns:error')
9+
const log = debug('ipfs:ipns')
10+
log.error = debug('ipfs:ipns:error')
1111

1212
const IpnsPublisher = require('./publisher')
1313
const IpnsRepublisher = require('./republisher')

src/core/ipns/path.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
const isIPFS = require('is-ipfs')
44

55
const debug = require('debug')
6-
const log = debug('jsipfs:ipns:path')
7-
log.error = debug('jsipfs:ipns:path:error')
6+
const log = debug('ipfs:ipns:path')
7+
log.error = debug('ipfs:ipns:path:error')
88

99
// resolves the given path by parsing out protocol-specific entries
1010
// (e.g. /ipns/<node-key>) and then going through the /ipfs/ entries and returning the final node

src/core/ipns/publisher.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ const series = require('async/series')
66
const errcode = require('err-code')
77

88
const debug = require('debug')
9-
const log = debug('jsipfs:ipns:publisher')
10-
log.error = debug('jsipfs:ipns:publisher:error')
9+
const log = debug('ipfs:ipns:publisher')
10+
log.error = debug('ipfs:ipns:publisher:error')
1111

1212
const ipns = require('ipns')
1313

src/core/ipns/republisher.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ const errcode = require('err-code')
88
const debug = require('debug')
99
const each = require('async/each')
1010
const waterfall = require('async/waterfall')
11-
const log = debug('jsipfs:ipns:republisher')
12-
log.error = debug('jsipfs:ipns:republisher:error')
11+
const log = debug('ipfs:ipns:republisher')
12+
log.error = debug('ipfs:ipns:republisher:error')
1313

1414
const minute = 60 * 1000
1515
const hour = 60 * minute

src/core/ipns/resolver.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ const PeerId = require('peer-id')
66
const errcode = require('err-code')
77

88
const debug = require('debug')
9-
const log = debug('jsipfs:ipns:resolver')
10-
log.error = debug('jsipfs:ipns:resolver:error')
9+
const log = debug('ipfs:ipns:resolver')
10+
log.error = debug('ipfs:ipns:resolver:error')
1111

1212
const defaultMaximumRecursiveDepth = 32
1313

src/core/ipns/routing/offline-datastore.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ const { encodeBase32 } = require('./utils')
66

77
const errcode = require('err-code')
88
const debug = require('debug')
9-
const log = debug('jsipfs:ipns:offline-datastore')
10-
log.error = debug('jsipfs:ipns:offline-datastore:error')
9+
const log = debug('ipfs:ipns:offline-datastore')
10+
log.error = debug('ipfs:ipns:offline-datastore:error')
1111

1212
// Offline datastore aims to mimic the same encoding as routing when storing records
1313
// to the local datastore

src/core/ipns/routing/pubsub-datastore.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ const withIs = require('class-is')
88

99
const errcode = require('err-code')
1010
const debug = require('debug')
11-
const log = debug('jsipfs:ipns:pubsub')
12-
log.error = debug('jsipfs:ipns:pubsub:error')
11+
const log = debug('ipfs:ipns:pubsub')
12+
log.error = debug('ipfs:ipns:pubsub:error')
1313

1414
// Pubsub datastore aims to manage the pubsub subscriptions for IPNS
1515
class IpnsPubsubDatastore {

src/core/mfs-preload.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
const debug = require('debug')
44

5-
const log = debug('jsipfs:mfs-preload')
6-
log.error = debug('jsipfs:mfs-preload:error')
5+
const log = debug('ipfs:mfs-preload')
6+
log.error = debug('ipfs:mfs-preload:error')
77

88
module.exports = (self) => {
99
const options = self._options.preload || {}

src/core/preload.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ const debug = require('debug')
77
const CID = require('cids')
88
const preload = require('./runtime/preload-nodejs')
99

10-
const log = debug('jsipfs:preload')
11-
log.error = debug('jsipfs:preload:error')
10+
const log = debug('ipfs:preload')
11+
log.error = debug('ipfs:preload:error')
1212

1313
const noop = (err) => { if (err) log.error(err) }
1414

src/core/runtime/preload-browser.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33

44
const debug = require('debug')
55

6-
const log = debug('jsipfs:preload')
7-
log.error = debug('jsipfs:preload:error')
6+
const log = debug('ipfs:preload')
7+
log.error = debug('ipfs:preload:error')
88

99
module.exports = function preload (url, callback) {
1010
log(url)

src/core/runtime/preload-nodejs.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ const { URL } = require('url')
66
const debug = require('debug')
77
const setImmediate = require('async/setImmediate')
88

9-
const log = debug('jsipfs:preload')
10-
log.error = debug('jsipfs:preload:error')
9+
const log = debug('ipfs:preload')
10+
log.error = debug('ipfs:preload:error')
1111

1212
module.exports = function preload (url, callback) {
1313
log(url)

src/core/state.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
'use strict'
22

33
const debug = require('debug')
4-
const log = debug('jsipfs:state')
5-
log.error = debug('jsipfs:state:error')
4+
const log = debug('ipfs:state')
5+
log.error = debug('ipfs:state:error')
66

77
const fsm = require('fsm-event')
88

src/http/api/resources/block.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ const multibase = require('multibase')
77
const Boom = require('boom')
88
const { cidToString } = require('../../../utils/cid')
99
const debug = require('debug')
10-
const log = debug('jsipfs:http-api:block')
11-
log.error = debug('jsipfs:http-api:block:error')
10+
const log = debug('ipfs:http-api:block')
11+
log.error = debug('ipfs:http-api:block:error')
1212

1313
// common pre request handler that parses the args and returns `key` which is assigned to `request.pre.args`
1414
exports.parseKey = (request, h) => {

src/http/api/resources/config.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
const debug = require('debug')
44
const get = require('lodash/get')
55
const set = require('lodash/set')
6-
const log = debug('jsipfs:http-api:config')
7-
log.error = debug('jsipfs:http-api:config:error')
6+
const log = debug('ipfs:http-api:config')
7+
log.error = debug('ipfs:http-api:config:error')
88
const multipart = require('ipfs-multipart')
99
const Boom = require('boom')
1010

src/http/api/resources/dht.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ const Boom = require('boom')
66
const CID = require('cids')
77

88
const debug = require('debug')
9-
const log = debug('jsipfs:http-api:dht')
10-
log.error = debug('jsipfs:http-api:dht:error')
9+
const log = debug('ipfs:http-api:dht')
10+
log.error = debug('ipfs:http-api:dht:error')
1111

1212
exports = module.exports
1313

src/http/api/resources/files-regular.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
const multipart = require('ipfs-multipart')
44
const debug = require('debug')
55
const tar = require('tar-stream')
6-
const log = debug('jsipfs:http-api:files')
7-
log.error = debug('jsipfs:http-api:files:error')
6+
const log = debug('ipfs:http-api:files')
7+
log.error = debug('ipfs:http-api:files:error')
88
const pull = require('pull-stream')
99
const toPull = require('stream-to-pull-stream')
1010
const pushable = require('pull-pushable')

src/http/api/resources/object.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ const multibase = require('multibase')
1313
const Boom = require('boom')
1414
const { cidToString } = require('../../../utils/cid')
1515
const debug = require('debug')
16-
const log = debug('jsipfs:http-api:object')
17-
log.error = debug('jsipfs:http-api:object:error')
16+
const log = debug('ipfs:http-api:object')
17+
log.error = debug('ipfs:http-api:object:error')
1818

1919
// common pre request handler that parses the args and returns `key` which is assigned to `request.pre.args`
2020
exports.parseKey = (request, h) => {

src/http/api/resources/resolve.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ const Joi = require('joi')
44
const debug = require('debug')
55
const multibase = require('multibase')
66

7-
const log = debug('jsipfs:http-api:resolve')
8-
log.error = debug('jsipfs:http-api:resolve:error')
7+
const log = debug('ipfs:http-api:resolve')
8+
log.error = debug('ipfs:http-api:resolve:error')
99

1010
module.exports = {
1111
validate: {

src/http/gateway/resources/gateway.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
'use strict'
22

33
const debug = require('debug')
4-
const log = debug('jsipfs:http-gateway')
5-
log.error = debug('jsipfs:http-gateway:error')
4+
const log = debug('ipfs:http-gateway')
5+
log.error = debug('ipfs:http-gateway:error')
66
const pull = require('pull-stream')
77
const pushable = require('pull-pushable')
88
const toStream = require('pull-stream-to-stream')

src/http/index.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ function hapiInfoToMultiaddr (info) {
3232
class HttpApi {
3333
constructor (options) {
3434
this._options = options || {}
35-
this._log = debug('jsipfs:http-api')
36-
this._log.error = debug('jsipfs:http-api:error')
35+
this._log = debug('ipfs:http-api')
36+
this._log.error = debug('ipfs:http-api:error')
3737

3838
if (process.env.IPFS_MONITORING) {
3939
// Setup debug metrics collection

0 commit comments

Comments
 (0)