6b11f67dc6
- Logging is available in main process as well as renderer process, and entries all go to one set of rotating files. Log entries in the renderer process go to DevTools as well as the console. Entries from the main process only show up in the console. - We save three days of logs, one day per file in %userData%/logs - The 'debug' object store is deleted in a new database migration - Timestamps and level included in the new log we generate for publish as well as the devtools - The bunyan API is exposed via windows.log (providing the ability to log at different levels, and save objects instead of just text), so we can move our code to it over time. FREEBIE
62 lines
1.8 KiB
JavaScript
62 lines
1.8 KiB
JavaScript
/*
|
|
* vim: ts=4:sw=4:expandtab
|
|
*/
|
|
(function () {
|
|
'use strict';
|
|
window.Whisper = window.Whisper || {};
|
|
|
|
Whisper.DebugLogLinkView = Whisper.View.extend({
|
|
templateName: 'debug-log-link',
|
|
initialize: function(options) {
|
|
this.url = options.url;
|
|
},
|
|
render_attributes: function() {
|
|
return {
|
|
url: this.url,
|
|
reportIssue: i18n('reportIssue')
|
|
};
|
|
}
|
|
});
|
|
Whisper.DebugLogView = Whisper.View.extend({
|
|
templateName: 'debug-log',
|
|
className: 'debug-log modal',
|
|
initialize: function() {
|
|
this.render();
|
|
this.$('textarea').val(log.fetch());
|
|
},
|
|
events: {
|
|
'click .submit': 'submit',
|
|
'click .close': 'close'
|
|
},
|
|
render_attributes: {
|
|
title: i18n('submitDebugLog'),
|
|
cancel: i18n('cancel'),
|
|
submit: i18n('submit'),
|
|
close: i18n('gotIt'),
|
|
debugLogExplanation: i18n('debugLogExplanation')
|
|
},
|
|
close: function(e) {
|
|
e.preventDefault();
|
|
this.remove();
|
|
},
|
|
submit: function(e) {
|
|
e.preventDefault();
|
|
var text = this.$('textarea').val();
|
|
if (text.length === 0) {
|
|
return;
|
|
}
|
|
log.publish(text).then(function(url) {
|
|
var view = new Whisper.DebugLogLinkView({
|
|
url: url,
|
|
el: this.$('.result')
|
|
});
|
|
this.$('.loading').removeClass('loading');
|
|
view.render();
|
|
this.$('.link').focus().select();
|
|
}.bind(this));
|
|
this.$('.buttons, textarea').remove();
|
|
this.$('.result').addClass('loading');
|
|
}
|
|
});
|
|
|
|
})();
|