Skip to content
This repository was archived by the owner on Aug 2, 2022. It is now read-only.

Commit 969c816

Browse files
author
James Calfee
committed
Logging updates #191
1 parent 73e4a3f commit 969c816

File tree

5 files changed

+14
-16
lines changed

5 files changed

+14
-16
lines changed

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ eos = Eos(config)
142142

143143
* **verbose** `[boolean=false]` - verbose logging such as API activity.
144144

145-
* **debug** `[boolean=false]` - low level debug logging.
145+
* **debug** `[boolean=false]` - low level debug logging (serialization).
146146

147147
* **sign** `[boolean=true]` - sign the transaction with a private key. Leaving
148148
a transaction unsigned avoids the need to provide a private key.
@@ -163,7 +163,6 @@ eos = Eos(config)
163163
```js
164164
logger: {
165165
log: config.verbose ? console.log : null,
166-
debug: config.debug ? console.log : null,
167166
error: console.error // null to disable
168167
}
169168
```

package-lock.json

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
"babel-runtime": "^6.26.0",
4848
"binaryen": "^37.0.0",
4949
"create-hash": "^1.1.3",
50-
"eosjs-api": "6.1.3",
50+
"eosjs-api": "6.2.1",
5151
"eosjs-ecc": "4.0.1",
5252
"fcbuffer": "2.2.0"
5353
},

src/index.js

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,18 @@ const schema = require('./schema')
1212
const pkg = require('../package.json')
1313

1414
const Eos = (config = {}) => {
15-
16-
const defaultLogger = {
17-
log: config.verbose ? console.log : null,
18-
debug: config.debug ? console.log : null,
19-
error: console.error
20-
}
21-
2215
config = Object.assign({}, {
2316
httpEndpoint: 'http://127.0.0.1:8888',
24-
broadcast: true,
2517
debug: false,
18+
verbose: false,
19+
broadcast: true,
2620
sign: true
2721
}, config)
2822

23+
const defaultLogger = {
24+
log: config.verbose ? console.log : null,
25+
error: console.error
26+
}
2927
config.logger = Object.assign({}, defaultLogger, config.logger)
3028

3129
return createEos(config)

src/write-api.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -506,10 +506,11 @@ function WriteApi(Network, network, config, Transaction) {
506506
transaction: packedTr
507507
})
508508
} else {
509-
const error = `[push_transaction error] '${error.message}', transaction '${buf.toString('hex')}'`
510509

511510
if(config.logger.error) {
512-
config.logger.error(error)
511+
config.logger.error(
512+
`[push_transaction error] '${error.message}', transaction '${buf.toString('hex')}'`
513+
)
513514
}
514515

515516
callback(error.message)

0 commit comments

Comments
 (0)