use channel prefix for differentiating with app logs

This commit is contained in:
Aleksis Brezas 2014-10-06 12:27:11 +00:00 committed by Pablo Carranza Vélez
parent df2066e4de
commit b24a06a935

View File

@ -28,11 +28,11 @@ publish = do ->
knex('config').select('value').where(key: 'uuid').then ([ uuid ]) -> knex('config').select('value').where(key: 'uuid').then ([ uuid ]) ->
uuid = uuid.value uuid = uuid.value
channel = "device-#{uuid}-logs" channel = "device-#{uuid}-"
# Redefine original function # Redefine original function
publish = (message, isMeta=false) -> publish = (message, channelPrefix="logs") ->
pubnub.publish({ channel, message, isMeta }) pubnub.publish({ channel + channelPrefix, message })
# Replay queue now that we have initialised the publish function # Replay queue now that we have initialised the publish function
publish(args...) for args in publishQueue publish(args...) for args in publishQueue
@ -40,7 +40,7 @@ publish = do ->
return -> publishQueue.push(arguments) return -> publishQueue.push(arguments)
exports.logSupervisorEvent = logSupervisorEvent = (message) -> exports.logSupervisorEvent = logSupervisorEvent = (message) ->
publish(message, true) publish(message, "meta-logs")
exports.kill = kill = (app) -> exports.kill = kill = (app) ->
logSupervisorEvent( 'Killing application ' + app.imageId ) logSupervisorEvent( 'Killing application ' + app.imageId )