Change debug output to use debug module

This commit is contained in:
Christian Bundy 2019-06-30 13:08:31 -07:00
parent 0646fceca5
commit a7cd6e1533
No known key found for this signature in database
GPG Key ID: EB541AAEF4366237
2 changed files with 8 additions and 3 deletions

View File

@ -10,6 +10,7 @@ module.exports = (config) => {
const mount = require('koa-mount')
const open = require('open')
const koaBody = require('koa-body')
const debug = require('debug')('oasis')
const author = require('./routes/author')
const hashtag = require('./routes/hashtag')
@ -43,7 +44,9 @@ module.exports = (config) => {
const uri = `http://${config.host}:${config.port}/`
app.listen(config.port)
console.log(`Listening on http://${uri}`)
debug.enabled = true
debug(`Listening on http://${uri}`)
if (config.open === true) {
open(uri)

View File

@ -1,6 +1,7 @@
const ssbClient = require('ssb-client')
const secretStack = require('secret-stack')
const ssbConfig = require('ssb-config')
const debug = require('debug')('oasis')
const server = secretStack()
@ -31,10 +32,11 @@ const db = {
}
}
debug.enabled = true
db.connect().then(() =>
console.log('Using pre-existing Scuttlebutt server instead of starting one')
debug('Using pre-existing Scuttlebutt server instead of starting one')
).catch(() => {
console.log('Starting Scuttlebutt server')
debug('Starting Scuttlebutt server')
server
.use(require('ssb-db'))