Skip to content

Commit

Permalink
Merge pull request #26 from istnv/chore/log
Browse files Browse the repository at this point in the history
Reduce log entries
  • Loading branch information
istnv authored Aug 25, 2024
2 parents 62cc561 + 16b307c commit 8546781
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
12 changes: 8 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@ class TSPInstance extends InstanceBase {
tServer.on('connection', (socket) => {
let cid = socket.remoteAddress + ':' + socket.remotePort
this.tSockets.push(socket)
this.log('debug',`Connection from ${cid}`)
this.updateVariables()
socket.setKeepAlive(true,60000)

Expand All @@ -238,7 +239,7 @@ class TSPInstance extends InstanceBase {

socket.on('data', (data) => {
// forward data to the serial port
this.log('debug', 'TCP: ' + toHex(data.toString('latin1') + ' '))
this.log('debug', 'TCP: ' + toHex(data.toString('latin1')) + ' ')
this.sPort.write(data)
if (this.config.response == true) {
this.SERIAL_INTERVAL = setTimeout(this.sendError.bind(this), this.config.maxresponse)
Expand Down Expand Up @@ -353,13 +354,16 @@ class TSPInstance extends InstanceBase {
for (const [k, v] of Object.entries(p)) {
nb += (nb == '' ? '' : ', ') + `${k}: ${v}`
}
this.log('debug', nb)
}
if (p.locationId || p.vendorId || p.pnpId) {
let path = p.path ? p.path : p.comName
let manu = p.manufacturer ? p.manufacturer : 'Internal'
this.foundPorts.push({
path: p.path ? p.path : p.comName,
manufacturer: p.manufacturer ? p.manufacturer : 'Internal',
path: path,
manufacturer: manu,
})
this.log('debug', `found: ${path} : ${manu}`)

}
})
if (this.foundPorts.length > 0) {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "generic-tcp-serial",
"version": "2.4.0",
"version": "2.4.1",
"main": "index.js",
"type": "module",
"scripts": {
Expand Down

0 comments on commit 8546781

Please sign in to comment.