summaryrefslogtreecommitdiff
path: root/lib/realtime.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/realtime.js')
-rw-r--r--lib/realtime.js30
1 files changed, 14 insertions, 16 deletions
diff --git a/lib/realtime.js b/lib/realtime.js
index d04ffdc2..d85d728e 100644
--- a/lib/realtime.js
+++ b/lib/realtime.js
@@ -49,7 +49,7 @@ function secure (socket, next) {
if (handshakeData.sessionID &&
handshakeData.cookie[config.sessionName] &&
handshakeData.cookie[config.sessionName] !== handshakeData.sessionID) {
- if (config.debug) { logger.info('AUTH success cookie: ' + handshakeData.sessionID) }
+ logger.debug(`AUTH success cookie: ${handshakeData.sessionID}`)
return next()
} else {
next(new Error('AUTH failed: Cookie is invalid.'))
@@ -82,7 +82,7 @@ setInterval(function () {
async.each(Object.keys(notes), function (key, callback) {
var note = notes[key]
if (note.server.isDirty) {
- if (config.debug) logger.info('updater found dirty note: ' + key)
+ logger.debug(`updater found dirty note: ${key}`)
note.server.isDirty = false
updateNote(note, function (err, _note) {
// handle when note already been clean up
@@ -182,7 +182,7 @@ setInterval(function () {
var socket = realtime.io.sockets.connected[key]
if ((!socket && users[key]) ||
(socket && (!socket.rooms || socket.rooms.length <= 0))) {
- if (config.debug) { logger.info('cleaner found redundant user: ' + key) }
+ logger.debug(`cleaner found redundant user: ${key}`)
if (!socket) {
socket = {
id: key
@@ -429,11 +429,11 @@ function finishConnection (socket, noteId, socketId) {
if (config.debug) {
let noteId = socket.noteId
- logger.info('SERVER connected a client to [' + noteId + ']:')
- logger.info(JSON.stringify(user))
- // logger.info(notes);
+ logger.debug(`SERVER connected a client to [${noteId}]:`)
+ logger.debug(JSON.stringify(user))
+ logger.debug(notes)
getStatus(function (data) {
- logger.info(JSON.stringify(data))
+ logger.debug(JSON.stringify(data))
})
}
}
@@ -541,10 +541,8 @@ function disconnect (socket) {
if (isDisconnectBusy) return
isDisconnectBusy = true
- if (config.debug) {
- logger.info('SERVER disconnected a client')
- logger.info(JSON.stringify(users[socket.id]))
- }
+ logger.debug('SERVER disconnected a client')
+ logger.debug(JSON.stringify(users[socket.id]))
if (users[socket.id]) {
delete users[socket.id]
@@ -574,9 +572,9 @@ function disconnect (socket) {
delete note.server
delete notes[noteId]
if (config.debug) {
- // logger.info(notes);
+ logger.debug(notes)
getStatus(function (data) {
- logger.info(JSON.stringify(data))
+ logger.debug(JSON.stringify(data))
})
}
})
@@ -595,9 +593,9 @@ function disconnect (socket) {
if (disconnectSocketQueue.length > 0) { disconnect(disconnectSocketQueue[0]) }
if (config.debug) {
- // logger.info(notes);
+ logger.debug(notes)
getStatus(function (data) {
- logger.info(JSON.stringify(data))
+ logger.debug(JSON.stringify(data))
})
}
}
@@ -774,7 +772,7 @@ function connection (socket) {
var noteId = socket.noteId
var user = users[socket.id]
if (!noteId || !notes[noteId] || !user) return
- if (config.debug) { logger.info('SERVER received [' + noteId + '] user status from [' + socket.id + ']: ' + JSON.stringify(data)) }
+ logger.debug(`SERVER received [${noteId}] user status from [${socket.id}]: ${JSON.stringify(data)}`)
if (data) {
user.idle = data.idle
user.type = data.type