Browse Source
Merge pull request #768 from mrfelton/fix/log-stderr-as-error
fix(log): log lnd stderr output as errors
renovate/lint-staged-8.x
JimmyMow
6 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with
9 additions and
14 deletions
-
app/lib/lnd/neutrino.js
-
app/lib/utils/log.js
|
|
@ -113,23 +113,18 @@ class Neutrino extends EventEmitter { |
|
|
|
|
|
|
|
// Listen for when neutrino prints data to stderr.
|
|
|
|
this.process.stderr.pipe(split2()).on('data', line => { |
|
|
|
if (process.env.NODE_ENV === 'development') { |
|
|
|
const level = lndLogGetLevel(line) |
|
|
|
lndLog[level](line) |
|
|
|
if (level === 'error') { |
|
|
|
this.lastError = line.split('[ERR] LTND:')[1] |
|
|
|
} |
|
|
|
lndLog.error(line) |
|
|
|
if (line.startsWith('panic:')) { |
|
|
|
this.lastError = line |
|
|
|
} |
|
|
|
}) |
|
|
|
|
|
|
|
// Listen for when neutrino prints data to stdout.
|
|
|
|
this.process.stdout.pipe(split2()).on('data', line => { |
|
|
|
if (process.env.NODE_ENV === 'development') { |
|
|
|
const level = lndLogGetLevel(line) |
|
|
|
lndLog[level](line) |
|
|
|
if (level === 'error') { |
|
|
|
this.lastError = line.split('[ERR] LTND:')[1] |
|
|
|
} |
|
|
|
const level = lndLogGetLevel(line) |
|
|
|
lndLog[level](line) |
|
|
|
if (level === 'error') { |
|
|
|
this.lastError = line.split('[ERR] LTND:')[1] |
|
|
|
} |
|
|
|
|
|
|
|
// password RPC server listening (wallet unlocker started).
|
|
|
|
|
|
@ -8,7 +8,7 @@ debugLogger.inspectOptions = { |
|
|
|
// Enable all zap logs if DEBUG has not been explicitly set.
|
|
|
|
if (!process.env.DEBUG) { |
|
|
|
// debugLogger.debug.enable('zap:*')
|
|
|
|
process.env.DEBUG = 'zap:main,zap:lnd*,zap:updater' |
|
|
|
process.env.DEBUG = 'zap:main,zap:lnd,zap:updater' |
|
|
|
} |
|
|
|
if (!process.env.DEBUG_LEVEL) { |
|
|
|
process.env.DEBUG_LEVEL = 'info' |
|
|
@ -53,7 +53,7 @@ const logConfig = name => ({ |
|
|
|
|
|
|
|
// Create logs for use in the app.
|
|
|
|
export const mainLog = debugLogger.config(logConfig('main'))('zap') |
|
|
|
export const lndLog = debugLogger.config(logConfig('lnd '))('zap') |
|
|
|
export const lndLog = debugLogger.config(logConfig('lnd'))('zap') |
|
|
|
export const updaterLog = debugLogger.config(logConfig('updater'))('zap') |
|
|
|
|
|
|
|
let lndLogLevel = null // stored most recent log level for continuity
|
|
|
|