Skip to content
This repository was archived by the owner on Feb 23, 2021. It is now read-only.

Commit f76fb13

Browse files
committed
Add Production Logs
1 parent 7ae4e64 commit f76fb13

File tree

3 files changed

+15
-1
lines changed

3 files changed

+15
-1
lines changed

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,13 @@ npm run setup
2626

2727
If the window doesn't load after running `npm start`: try clicking on dev tools window and hitting `cmd-r` to refresh the window.
2828

29+
### Logs
30+
Logs are written to the following locations:
31+
32+
* **Linux:** `~/.config/Lightning/log.log`
33+
* **OSX:** `~/Library/Logs/Lightning/log.log`
34+
* **Windows:** `%USERPROFILE%\AppData\Roaming\Lightning\log.log`
35+
2936
### Building
3037

3138
To build binaries for OSX:

packages/lightning-desktop/main.development.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import _ from 'lodash'
77
import observe from 'observe'
88
import cp from 'child_process'
99
import ps from 'ps-node'
10+
import fileLog from 'electron-log'
1011
import os from 'os'
1112
import lnd from './lnd'
1213

@@ -35,6 +36,7 @@ const runProcesses = (processes, logs) => {
3536
.then(() => {
3637
console.log(`${ proc.name } Already Running`)
3738
logs.push(`${ proc.name } Already Running`)
39+
fileLog.info(`${ proc.name } Already Running`)
3840
})
3941
.catch(() => {
4042
const plat = os.platform()
@@ -49,7 +51,10 @@ const runProcesses = (processes, logs) => {
4951
})
5052
runningProcesses.push(instance)
5153
instance.stdout.on('data', data => logs.push(`${ proc.name }: ${ data }`))
52-
instance.stderr.on('data', data => logs.push(`${ proc.name } Error: ${ data }`))
54+
instance.stderr.on('data', (data) => {
55+
logs.push(`${ proc.name } Error: ${ data }`)
56+
fileLog.error(`${ proc.name }: ${ data }`)
57+
})
5358
} catch (error) {
5459
console.log(`Caught Error When Starting ${ proc.name }: ${ error }`)
5560
logs.push(`Caught Error When Starting ${ proc.name }: ${ error }`)
@@ -195,4 +200,5 @@ app.on('quit', () => {
195200

196201
process.on('uncaughtException', (error) => {
197202
console.log('Caught Main Process Error:', error)
203+
fileLog.error(`Main Process: ${ error }`)
198204
})

packages/lightning-desktop/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
"concurrently": "^3.1.0",
2828
"css-loader": "^0.26.1",
2929
"electron-debug": "^1.1.0",
30+
"electron-log": "^2.2.6",
3031
"electron-packager": "^8.4.0",
3132
"electron-prebuilt": "^1.4.6",
3233
"electron-window-state": "^4.0.1",

0 commit comments

Comments
 (0)