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

Commit

Permalink
feat: log MOS-commands
Browse files Browse the repository at this point in the history
  • Loading branch information
nytamin committed Apr 11, 2019
1 parent f35c81e commit df7526c
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion src/coreHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,27 @@ export class CoreMosDeviceHandler {
})
// Make the commands be sent sequantially:
return this.core.putOnQueue('mos', () => {
return this.core.mosManipulate(method, ...attrs)

// Log info about the sent command:
let msg = 'Command: ' + method
if (attrs[0] && attrs[0].ID) msg = `${method}: ${attrs[0].ID}`
else if (attrs[0] && attrs[0] instanceof MosString128) msg = `${method}: ${attrs[0].toString()}`
else if (attrs[0] && attrs[0].ObjectId) msg = `${method}: ${attrs[0].ObjectId}`
else if (attrs[0] && attrs[0].StoryId) msg = `${method}: ${attrs[0].StoryId}`
else if (attrs[0] && attrs[0].StoryID) msg = `${method}: ${attrs[0].StoryID}`
else if (attrs[0] && attrs[0].ItemID) msg = `${method}: ${attrs[0].ItemID}`
else if (attrs[0] && attrs[0].RunningOrderID) msg = `${method}: ${attrs[0].RunningOrderID}`
else if (attrs[0] && attrs[0].toString) msg = `${method}: ${attrs[0].toString()}`

this._coreParentHandler.logger.info('Recieved MOS command: ' + msg)

return (
this.core.mosManipulate(method, ...attrs)
.catch(e => {
this._coreParentHandler.logger.info('MOS command rejected: ' + ((e && e.toString()) || e))
throw e
})
)
})
}
}
Expand Down

0 comments on commit df7526c

Please sign in to comment.