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

Commit

Permalink
fix(device-simulator): improve logging
Browse files Browse the repository at this point in the history
  • Loading branch information
coderbyheart committed Jul 24, 2019
1 parent 73f3b23 commit cb67903
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 11 deletions.
13 changes: 3 additions & 10 deletions scripts/connect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ const main = async (args: { deviceId: string }) => {
deviceUiUrl,
deviceId: clientId,
onUpdate: update => {
console.log({ clientId, state: { state: { reported: update } } })
console.log(chalk.magenta('<'), chalk.cyan(JSON.stringify(update)))
connection.update(clientId, { state: { reported: update } })
},
})
Expand All @@ -88,15 +88,8 @@ const main = async (args: { deviceId: string }) => {
console.log(chalk.magenta('reconnecting...'))
})

connection.on('status', function(thingName, stat, _, stateObject) {
console.log(
'received ' +
stat +
' on ' +
thingName +
': ' +
JSON.stringify(stateObject),
)
connection.on('status', (_, stat) => {
console.log(chalk.magenta('>'), chalk.cyan(stat))
})

connection.on('delta', function(thingName, stateObject) {
Expand Down
1 change: 0 additions & 1 deletion scripts/device/ui-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ export const uiServer = async (args: {
})
request.on('end', () => {
try {
console.log(body)
const update = JSON.parse(body)
args.onUpdate(update)
response.writeHead(202, {
Expand Down

0 comments on commit cb67903

Please sign in to comment.