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

Commit

Permalink
refactor: normalise debug logging prefix from jsipfs to just ipfs (#1911
Browse files Browse the repository at this point in the history
)

Shorter prefix ftw, MFS already uses "ipfs". Hooray \o/

License: MIT
Signed-off-by: Alan Shaw <alan.shaw@protocol.ai>
  • Loading branch information
Alan Shaw authored Mar 11, 2019
1 parent 87893a6 commit d2726fb
Show file tree
Hide file tree
Showing 25 changed files with 50 additions and 50 deletions.
4 changes: 2 additions & 2 deletions src/core/components/dht.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ const nextTick = require('async/nextTick')
const errcode = require('err-code')

const debug = require('debug')
const log = debug('jsipfs:dht')
log.error = debug('jsipfs:dht:error')
const log = debug('ipfs:dht')
log.error = debug('ipfs:dht:error')

module.exports = (self) => {
return {
Expand Down
4 changes: 2 additions & 2 deletions src/core/components/name-pubsub.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ const promisify = require('promisify-es6')

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

const log = debug('jsipfs:name-pubsub')
log.error = debug('jsipfs:name-pubsub:error')
const log = debug('ipfs:name-pubsub')
log.error = debug('ipfs:name-pubsub:error')

// Is pubsub enabled
const isNamePubsubEnabled = (node) => {
Expand Down
4 changes: 2 additions & 2 deletions src/core/components/name.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ const human = require('human-to-milliseconds')
const crypto = require('libp2p-crypto')
const errcode = require('err-code')

const log = debug('jsipfs:name')
log.error = debug('jsipfs:name:error')
const log = debug('ipfs:name')
log.error = debug('ipfs:name:error')

const namePubsub = require('./name-pubsub')
const utils = require('../utils')
Expand Down
4 changes: 2 additions & 2 deletions src/core/components/ping-pull-stream.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ const PeerId = require('peer-id')
const pull = require('pull-stream')
const Pushable = require('pull-pushable')

const log = debug('jsipfs:pingPullStream')
log.error = debug('jsipfs:pingPullStream:error')
const log = debug('ipfs:pingPullStream')
log.error = debug('ipfs:pingPullStream:error')

module.exports = function pingPullStream (self) {
return (peerId, opts) => {
Expand Down
4 changes: 2 additions & 2 deletions src/core/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@ class IPFS extends EventEmitter {
}

// IPFS utils
this.log = debug('jsipfs')
this.log.err = debug('jsipfs:err')
this.log = debug('ipfs')
this.log.err = debug('ipfs:err')

// IPFS Core Internals
// this._repo - assigned above
Expand Down
4 changes: 2 additions & 2 deletions src/core/ipns/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ const Receptacle = require('receptacle')

const errcode = require('err-code')
const debug = require('debug')
const log = debug('jsipfs:ipns')
log.error = debug('jsipfs:ipns:error')
const log = debug('ipfs:ipns')
log.error = debug('ipfs:ipns:error')

const IpnsPublisher = require('./publisher')
const IpnsRepublisher = require('./republisher')
Expand Down
4 changes: 2 additions & 2 deletions src/core/ipns/path.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
const isIPFS = require('is-ipfs')

const debug = require('debug')
const log = debug('jsipfs:ipns:path')
log.error = debug('jsipfs:ipns:path:error')
const log = debug('ipfs:ipns:path')
log.error = debug('ipfs:ipns:path:error')

// resolves the given path by parsing out protocol-specific entries
// (e.g. /ipns/<node-key>) and then going through the /ipfs/ entries and returning the final node
Expand Down
4 changes: 2 additions & 2 deletions src/core/ipns/publisher.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ const series = require('async/series')
const errcode = require('err-code')

const debug = require('debug')
const log = debug('jsipfs:ipns:publisher')
log.error = debug('jsipfs:ipns:publisher:error')
const log = debug('ipfs:ipns:publisher')
log.error = debug('ipfs:ipns:publisher:error')

const ipns = require('ipns')

Expand Down
4 changes: 2 additions & 2 deletions src/core/ipns/republisher.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ const errcode = require('err-code')
const debug = require('debug')
const each = require('async/each')
const waterfall = require('async/waterfall')
const log = debug('jsipfs:ipns:republisher')
log.error = debug('jsipfs:ipns:republisher:error')
const log = debug('ipfs:ipns:republisher')
log.error = debug('ipfs:ipns:republisher:error')

const minute = 60 * 1000
const hour = 60 * minute
Expand Down
4 changes: 2 additions & 2 deletions src/core/ipns/resolver.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ const PeerId = require('peer-id')
const errcode = require('err-code')

const debug = require('debug')
const log = debug('jsipfs:ipns:resolver')
log.error = debug('jsipfs:ipns:resolver:error')
const log = debug('ipfs:ipns:resolver')
log.error = debug('ipfs:ipns:resolver:error')

const defaultMaximumRecursiveDepth = 32

Expand Down
4 changes: 2 additions & 2 deletions src/core/ipns/routing/offline-datastore.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ const { encodeBase32 } = require('./utils')

const errcode = require('err-code')
const debug = require('debug')
const log = debug('jsipfs:ipns:offline-datastore')
log.error = debug('jsipfs:ipns:offline-datastore:error')
const log = debug('ipfs:ipns:offline-datastore')
log.error = debug('ipfs:ipns:offline-datastore:error')

// Offline datastore aims to mimic the same encoding as routing when storing records
// to the local datastore
Expand Down
4 changes: 2 additions & 2 deletions src/core/ipns/routing/pubsub-datastore.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ const withIs = require('class-is')

const errcode = require('err-code')
const debug = require('debug')
const log = debug('jsipfs:ipns:pubsub')
log.error = debug('jsipfs:ipns:pubsub:error')
const log = debug('ipfs:ipns:pubsub')
log.error = debug('ipfs:ipns:pubsub:error')

// Pubsub datastore aims to manage the pubsub subscriptions for IPNS
class IpnsPubsubDatastore {
Expand Down
4 changes: 2 additions & 2 deletions src/core/mfs-preload.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

const debug = require('debug')

const log = debug('jsipfs:mfs-preload')
log.error = debug('jsipfs:mfs-preload:error')
const log = debug('ipfs:mfs-preload')
log.error = debug('ipfs:mfs-preload:error')

module.exports = (self) => {
const options = self._options.preload || {}
Expand Down
4 changes: 2 additions & 2 deletions src/core/preload.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ const debug = require('debug')
const CID = require('cids')
const preload = require('./runtime/preload-nodejs')

const log = debug('jsipfs:preload')
log.error = debug('jsipfs:preload:error')
const log = debug('ipfs:preload')
log.error = debug('ipfs:preload:error')

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

Expand Down
4 changes: 2 additions & 2 deletions src/core/runtime/preload-browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

const debug = require('debug')

const log = debug('jsipfs:preload')
log.error = debug('jsipfs:preload:error')
const log = debug('ipfs:preload')
log.error = debug('ipfs:preload:error')

module.exports = function preload (url, callback) {
log(url)
Expand Down
4 changes: 2 additions & 2 deletions src/core/runtime/preload-nodejs.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ const { URL } = require('url')
const debug = require('debug')
const setImmediate = require('async/setImmediate')

const log = debug('jsipfs:preload')
log.error = debug('jsipfs:preload:error')
const log = debug('ipfs:preload')
log.error = debug('ipfs:preload:error')

module.exports = function preload (url, callback) {
log(url)
Expand Down
4 changes: 2 additions & 2 deletions src/core/state.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
'use strict'

const debug = require('debug')
const log = debug('jsipfs:state')
log.error = debug('jsipfs:state:error')
const log = debug('ipfs:state')
log.error = debug('ipfs:state:error')

const fsm = require('fsm-event')

Expand Down
4 changes: 2 additions & 2 deletions src/http/api/resources/block.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ const multibase = require('multibase')
const Boom = require('boom')
const { cidToString } = require('../../../utils/cid')
const debug = require('debug')
const log = debug('jsipfs:http-api:block')
log.error = debug('jsipfs:http-api:block:error')
const log = debug('ipfs:http-api:block')
log.error = debug('ipfs:http-api:block:error')

// common pre request handler that parses the args and returns `key` which is assigned to `request.pre.args`
exports.parseKey = (request, h) => {
Expand Down
4 changes: 2 additions & 2 deletions src/http/api/resources/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
const debug = require('debug')
const get = require('lodash/get')
const set = require('lodash/set')
const log = debug('jsipfs:http-api:config')
log.error = debug('jsipfs:http-api:config:error')
const log = debug('ipfs:http-api:config')
log.error = debug('ipfs:http-api:config:error')
const multipart = require('ipfs-multipart')
const Boom = require('boom')

Expand Down
4 changes: 2 additions & 2 deletions src/http/api/resources/dht.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ const Boom = require('boom')
const CID = require('cids')

const debug = require('debug')
const log = debug('jsipfs:http-api:dht')
log.error = debug('jsipfs:http-api:dht:error')
const log = debug('ipfs:http-api:dht')
log.error = debug('ipfs:http-api:dht:error')

exports = module.exports

Expand Down
4 changes: 2 additions & 2 deletions src/http/api/resources/files-regular.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
const multipart = require('ipfs-multipart')
const debug = require('debug')
const tar = require('tar-stream')
const log = debug('jsipfs:http-api:files')
log.error = debug('jsipfs:http-api:files:error')
const log = debug('ipfs:http-api:files')
log.error = debug('ipfs:http-api:files:error')
const pull = require('pull-stream')
const toPull = require('stream-to-pull-stream')
const pushable = require('pull-pushable')
Expand Down
4 changes: 2 additions & 2 deletions src/http/api/resources/object.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ const multibase = require('multibase')
const Boom = require('boom')
const { cidToString } = require('../../../utils/cid')
const debug = require('debug')
const log = debug('jsipfs:http-api:object')
log.error = debug('jsipfs:http-api:object:error')
const log = debug('ipfs:http-api:object')
log.error = debug('ipfs:http-api:object:error')

// common pre request handler that parses the args and returns `key` which is assigned to `request.pre.args`
exports.parseKey = (request, h) => {
Expand Down
4 changes: 2 additions & 2 deletions src/http/api/resources/resolve.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ const Joi = require('joi')
const debug = require('debug')
const multibase = require('multibase')

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

module.exports = {
validate: {
Expand Down
4 changes: 2 additions & 2 deletions src/http/gateway/resources/gateway.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
'use strict'

const debug = require('debug')
const log = debug('jsipfs:http-gateway')
log.error = debug('jsipfs:http-gateway:error')
const log = debug('ipfs:http-gateway')
log.error = debug('ipfs:http-gateway:error')
const pull = require('pull-stream')
const pushable = require('pull-pushable')
const toStream = require('pull-stream-to-stream')
Expand Down
4 changes: 2 additions & 2 deletions src/http/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ function hapiInfoToMultiaddr (info) {
class HttpApi {
constructor (options) {
this._options = options || {}
this._log = debug('jsipfs:http-api')
this._log.error = debug('jsipfs:http-api:error')
this._log = debug('ipfs:http-api')
this._log.error = debug('ipfs:http-api:error')

if (process.env.IPFS_MONITORING) {
// Setup debug metrics collection
Expand Down

0 comments on commit d2726fb

Please sign in to comment.