Repository navigation
log unhandled exceptions to flat file - #850
Conversation
| return `${process.env.LOCALAPPDATA}\\desktop\\${getFileName()}` | ||
| } else { | ||
| const home = Os.homedir() | ||
| return `${home}/Library/Logs/GitHub/${getFileName()}` |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| winston.configure({ | ||
| transports: [ | ||
| // log everything to the console | ||
| new ElectronConsole(), |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
…environment variable
111fab4 to
399b541
Compare
62f84c9 to
caa0947
Compare
|
Ready for review 🐱 |
| import * as winston from 'winston' | ||
| const Transport = winston.Transport | ||
|
|
||
| type LogLevel = 'emerg' | 'alert' | 'crit' | 'error' | 'warning' | 'notice' | 'info' | 'debug'; |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
|
|
||
| type LogLevel = 'emerg' | 'alert' | 'crit' | 'error' | 'warning' | 'notice' | 'info' | 'debug'; | ||
|
|
||
| export class ElectronConsole extends Transport { |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
|
|
||
| export class ElectronConsole extends Transport { | ||
|
|
||
| public constructor(options?: winston.ConsoleTransportOptions) { |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| return `${process.env.LOCALAPPDATA}\\desktop\\${getFileName()}` | ||
| } else { | ||
| const home = Os.homedir() | ||
| return `${home}/Library/Logs/GitHub/${getFileName()}` |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| return `${process.env.LOCALAPPDATA}\\desktop\\${getFileName()}` | ||
| } else { | ||
| const home = Os.homedir() | ||
| return `${home}/Library/Logs/GitHub/${getFileName()}` |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| } | ||
|
|
||
| const filename = getLogFilePath() | ||
| createDirectoryIfNotFound(filename) |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
|
|
||
| // TODO: confirm that one logger is instantiated once for the renderer process | ||
| // and once for the main process | ||
| let logger: ILogger | null = null |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| // and once for the main process | ||
| let logger: ILogger | null = null | ||
|
|
||
| export function getLogger(directory: string): ILogger { |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
|
🍎 |
| import { ElectronConsole } from './electron-console' | ||
|
|
||
| interface ILogger { | ||
| filename: string, |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
|
|
||
| // TODO: confirm that one logger is instantiated once for the renderer process | ||
| // and once for the main process | ||
| let logger: ILogger | null = null |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
|
|
||
| if (process.platform === 'darwin') { | ||
| if (process.env.TRAVIS_TEST_RESULT === '1') { | ||
| reviewLogs() |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| // and once for the main process | ||
| let logger: ILogger | null = null | ||
|
|
||
| export function getLogger(directory: string): ILogger { |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
|
🍏 |
|
🎂 |
🌵 🌵 Go review #849 first so I can test this failing behaviour before merging
master🌵🌵A simpler version of #833:
uncaughtException, but we can expand this out to other parts of the appHere's what it looks like (for development mode):
developmentandproduction