Skip to content

Commit

Permalink
fix log data corruption
Browse files Browse the repository at this point in the history
  • Loading branch information
rjrodger committed Sep 2, 2019
1 parent 9e1aaba commit 34cef1c
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 415 deletions.
15 changes: 8 additions & 7 deletions lib/logging.js
Expand Up @@ -63,7 +63,7 @@ function flat_logger(entry) {
}
level_str = level_str.substring(0, 5)

var da =
var ds =
null != entry.err
? [entry.err.message, entry.err.callpoint]
: null != entry.res
Expand All @@ -76,16 +76,17 @@ function flat_logger(entry) {
? [entry.data]
: []

for (var i = 0; i < da.length; i++) {
da[i] = 'object' === typeof da[i] ? Common.clean(da[i]) : da[i]
da[i] = Util.inspect(da[i], {
var da = new Array(ds.length)
for (var i = 0; i < ds.length; i++) {
ds[i] = 'object' === typeof da[i] ? Common.clean(da[i]) : da[i]
ds[i] = Util.inspect(ds[i], {
compact: true,
depth: entry.depth$ || 3,
breakLength: Infinity
})
}

var data_str = da.join(' ')
var data_str = ds.join(' ')

var plugin_str =
null == entry.plugin_name
Expand All @@ -97,7 +98,7 @@ function flat_logger(entry) {

var sb = [
entry.isot,
entry.seneca_id,
'string' === typeof(entry.seneca_id) ? entry.seneca_id.substring(0,5) : '-----',
level_str,
null == entry.kind ? 'log' : entry.kind,
null == entry.case ? 'LOG' : entry.case,
Expand All @@ -109,7 +110,7 @@ function flat_logger(entry) {
entry.callpoint ? Util.inspect(entry.callpoint) : ''
]

console.log(sb.join(' ').substring(0, entry.maxlen$ || 11111))
console.log(sb.join('\t').substring(0, entry.maxlen$ || 11111))
}

// TODO: make default in 4.x
Expand Down
9 changes: 7 additions & 2 deletions lib/transport.js
Expand Up @@ -253,9 +253,14 @@ function hook_listen_web(msg, reply) {
})

function listen() {
var port = (config.port = seneca.util.resolve_option(config.port, config))
var host = (config.host = seneca.util.resolve_option(config.host, config))

seneca.log.debug(`transport web listen`, config)

return server.listen(
(config.port = seneca.util.resolve_option(config.port, config)),
(config.host = seneca.util.resolve_option(config.host, config))
port,
host
)
}

Expand Down

0 comments on commit 34cef1c

Please sign in to comment.