mirror of
https://github.com/Foundry376/Mailspring.git
synced 2024-11-12 12:40:08 +08:00
8133cc88d6
Summary: - We now make verbose log files continuously as you use the app - We ship the logs to LogStash via S3 when an exception occurs - We log the DatabaseStore, ActionBridge and Analytics packages - We are now on the latest version of Electron 0.26.0 - We are now on Chrome 42 and io.js 1.4.3 - We should be setup to use ASAR soon. Update atom.sh to reflect that we're now electron oniguruma was unnecessary correctly find log files that haven't been shipped yet Fix a small issue with nodeIsVisible after upgrade to Chrome 42 Delete old logs, better logging from database store, don't ship empty logs Test Plan: Run existing tests Reviewers: evan Reviewed By: evan Differential Revision: https://phab.nylas.com/D1531
62 lines
1.5 KiB
CoffeeScript
62 lines
1.5 KiB
CoffeeScript
{userAgent, taskPath} = process.env
|
|
handler = null
|
|
|
|
setupGlobals = ->
|
|
global.attachEvent = ->
|
|
console =
|
|
warn: -> emit 'task:warn', arguments...
|
|
log: -> emit 'task:log', arguments...
|
|
error: -> emit 'task:error', arguments...
|
|
trace: ->
|
|
global.__defineGetter__ 'console', -> console
|
|
|
|
fs = require 'fs'
|
|
fs.existsSync = (path) ->
|
|
try
|
|
fs.accessSync(path)
|
|
return true
|
|
catch
|
|
return false
|
|
|
|
global.document =
|
|
createElement: ->
|
|
setAttribute: ->
|
|
getElementsByTagName: -> []
|
|
appendChild: ->
|
|
documentElement:
|
|
insertBefore: ->
|
|
removeChild: ->
|
|
getElementById: -> {}
|
|
createComment: -> {}
|
|
createDocumentFragment: -> {}
|
|
|
|
global.emit = (event, args...) ->
|
|
process.send({event, args})
|
|
global.navigator = {userAgent: userAgent}
|
|
global.window = global
|
|
|
|
handleEvents = ->
|
|
process.on 'uncaughtException', (error) ->
|
|
console.error(error.message, error.stack)
|
|
process.on 'message', ({event, args}={}) ->
|
|
return unless event is 'start'
|
|
|
|
isAsync = false
|
|
async = ->
|
|
isAsync = true
|
|
(result) ->
|
|
emit('task:completed', result)
|
|
result = handler.bind({async})(args...)
|
|
emit('task:completed', result) unless isAsync
|
|
|
|
setupDeprecations = ->
|
|
Grim = require 'grim'
|
|
Grim.on 'updated', ->
|
|
deprecations = Grim.getDeprecations().map (deprecation) -> deprecation.serialize()
|
|
Grim.clearDeprecations()
|
|
emit('task:deprecations', deprecations)
|
|
|
|
setupGlobals()
|
|
handleEvents()
|
|
setupDeprecations()
|
|
handler = require(taskPath)
|