lookingGlass: Remove the "Errors" tab
We already have one too many logging systems. Remove the errors tab and make global.log/global.logError point to window.log/window.logError instead. https://bugzilla.gnome.org/show_bug.cgi?id=675104
This commit is contained in:
parent
32107ba8b5
commit
78e894c6f2
@ -634,45 +634,6 @@ const Inspector = new Lang.Class({
|
|||||||
|
|
||||||
Signals.addSignalMethods(Inspector.prototype);
|
Signals.addSignalMethods(Inspector.prototype);
|
||||||
|
|
||||||
const ErrorLog = new Lang.Class({
|
|
||||||
Name: 'ErrorLog',
|
|
||||||
|
|
||||||
_init: function() {
|
|
||||||
this.actor = new St.BoxLayout();
|
|
||||||
this.text = new St.Label();
|
|
||||||
this.actor.add(this.text);
|
|
||||||
// We need to override StLabel's default ellipsization when
|
|
||||||
// using line_wrap; otherwise ClutterText's layout is going
|
|
||||||
// to constrain both the width and height, which prevents
|
|
||||||
// scrolling.
|
|
||||||
this.text.clutter_text.ellipsize = Pango.EllipsizeMode.NONE;
|
|
||||||
this.text.clutter_text.line_wrap = true;
|
|
||||||
this.actor.connect('notify::mapped', Lang.bind(this, this._renderText));
|
|
||||||
},
|
|
||||||
|
|
||||||
_formatTime: function(d){
|
|
||||||
function pad(n) { return n < 10 ? '0' + n : n; }
|
|
||||||
return d.getUTCFullYear()+'-'
|
|
||||||
+ pad(d.getUTCMonth()+1)+'-'
|
|
||||||
+ pad(d.getUTCDate())+'T'
|
|
||||||
+ pad(d.getUTCHours())+':'
|
|
||||||
+ pad(d.getUTCMinutes())+':'
|
|
||||||
+ pad(d.getUTCSeconds())+'Z';
|
|
||||||
},
|
|
||||||
|
|
||||||
_renderText: function() {
|
|
||||||
if (!this.actor.mapped)
|
|
||||||
return;
|
|
||||||
let text = this.text.text;
|
|
||||||
let stack = Main._getAndClearErrorStack();
|
|
||||||
for (let i = 0; i < stack.length; i++) {
|
|
||||||
let logItem = stack[i];
|
|
||||||
text += logItem.category + ' t=' + this._formatTime(new Date(logItem.timestamp)) + ' ' + logItem.message + '\n';
|
|
||||||
}
|
|
||||||
this.text.text = text;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
const Memory = new Lang.Class({
|
const Memory = new Lang.Class({
|
||||||
Name: 'Memory',
|
Name: 'Memory',
|
||||||
|
|
||||||
@ -947,9 +908,6 @@ const LookingGlass = new Lang.Class({
|
|||||||
}));
|
}));
|
||||||
notebook.appendPage('Windows', this._windowList.actor);
|
notebook.appendPage('Windows', this._windowList.actor);
|
||||||
|
|
||||||
this._errorLog = new ErrorLog();
|
|
||||||
notebook.appendPage('Errors', this._errorLog.actor);
|
|
||||||
|
|
||||||
this._memory = new Memory();
|
this._memory = new Memory();
|
||||||
notebook.appendPage('Memory', this._memory.actor);
|
notebook.appendPage('Memory', this._memory.actor);
|
||||||
|
|
||||||
|
@ -67,7 +67,6 @@ let statusIconDispatcher = null;
|
|||||||
let keyboard = null;
|
let keyboard = null;
|
||||||
let layoutManager = null;
|
let layoutManager = null;
|
||||||
let networkAgent = null;
|
let networkAgent = null;
|
||||||
let _errorLogStack = [];
|
|
||||||
let _startDate;
|
let _startDate;
|
||||||
let _defaultCssStylesheet = null;
|
let _defaultCssStylesheet = null;
|
||||||
let _cssStylesheet = null;
|
let _cssStylesheet = null;
|
||||||
@ -153,11 +152,9 @@ function _initUserSession() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function start() {
|
function start() {
|
||||||
// Monkey patch utility functions into the global proxy;
|
// These are here so we don't break compatibility.
|
||||||
// This is easier and faster than indirecting down into global
|
global.logError = window.log;
|
||||||
// if we want to call back up into JS.
|
global.log = window.log;
|
||||||
global.logError = _logError;
|
|
||||||
global.log = _logDebug;
|
|
||||||
|
|
||||||
// Chain up async errors reported from C
|
// Chain up async errors reported from C
|
||||||
global.connect('notify-error', function (global, msg, detail) { notifyError(msg, detail); });
|
global.connect('notify-error', function (global, msg, detail) { notifyError(msg, detail); });
|
||||||
@ -254,7 +251,6 @@ function start() {
|
|||||||
|
|
||||||
global.stage.connect('captured-event', _globalKeyPressHandler);
|
global.stage.connect('captured-event', _globalKeyPressHandler);
|
||||||
|
|
||||||
_log('info', 'loaded at ' + _startDate);
|
|
||||||
log('GNOME Shell started at ' + _startDate);
|
log('GNOME Shell started at ' + _startDate);
|
||||||
|
|
||||||
let perfModuleName = GLib.getenv("SHELL_PERF_MODULE");
|
let perfModuleName = GLib.getenv("SHELL_PERF_MODULE");
|
||||||
@ -540,59 +536,6 @@ function notifyError(msg, details) {
|
|||||||
notify(msg, details);
|
notify(msg, details);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* _log:
|
|
||||||
* @category: string message type ('info', 'error')
|
|
||||||
* @msg: A message string
|
|
||||||
* ...: Any further arguments are converted into JSON notation,
|
|
||||||
* and appended to the log message, separated by spaces.
|
|
||||||
*
|
|
||||||
* Log a message into the LookingGlass error
|
|
||||||
* stream. This is primarily intended for use by the
|
|
||||||
* extension system as well as debugging.
|
|
||||||
*/
|
|
||||||
function _log(category, msg) {
|
|
||||||
let text = msg;
|
|
||||||
if (arguments.length > 2) {
|
|
||||||
text += ': ';
|
|
||||||
for (let i = 2; i < arguments.length; i++) {
|
|
||||||
text += JSON.stringify(arguments[i]);
|
|
||||||
if (i < arguments.length - 1)
|
|
||||||
text += ' ';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
_errorLogStack.push({timestamp: new Date().getTime(),
|
|
||||||
category: category,
|
|
||||||
message: text });
|
|
||||||
}
|
|
||||||
|
|
||||||
function _logError(msg) {
|
|
||||||
return _log('error', msg);
|
|
||||||
}
|
|
||||||
|
|
||||||
function _logDebug(msg) {
|
|
||||||
return _log('debug', msg);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Used by the error display in lookingGlass.js
|
|
||||||
function _getAndClearErrorStack() {
|
|
||||||
let errors = _errorLogStack;
|
|
||||||
_errorLogStack = [];
|
|
||||||
return errors;
|
|
||||||
}
|
|
||||||
|
|
||||||
function logStackTrace(msg) {
|
|
||||||
try {
|
|
||||||
throw new Error();
|
|
||||||
} catch (e) {
|
|
||||||
// e.stack must have at least two lines, with the first being
|
|
||||||
// logStackTrace() (which we strip off), and the second being
|
|
||||||
// our caller.
|
|
||||||
let trace = e.stack.substr(e.stack.indexOf('\n') + 1);
|
|
||||||
log(msg ? (msg + '\n' + trace) : trace);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function isWindowActorDisplayedOnWorkspace(win, workspaceIndex) {
|
function isWindowActorDisplayedOnWorkspace(win, workspaceIndex) {
|
||||||
return win.get_workspace() == workspaceIndex ||
|
return win.get_workspace() == workspaceIndex ||
|
||||||
(win.get_meta_window() && win.get_meta_window().is_on_all_workspaces());
|
(win.get_meta_window() && win.get_meta_window().is_on_all_workspaces());
|
||||||
|
Loading…
Reference in New Issue
Block a user