main: Override global logError() function
logError() prints an exception with an optional prefix, and is used fairly commonly through-out the code base. The problem is that by being defined in gjs, it uses "Gjs" as the GLib log domain, not our own as expected. Address this by adding a small override that implements the function with console.error(). Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3072>
This commit is contained in:
parent
ee150f2949
commit
dc655b9ed0
@ -143,6 +143,16 @@ function _sessionUpdated() {
|
||||
/** @returns {void} */
|
||||
export async function start() {
|
||||
globalThis.log = console.log;
|
||||
globalThis.logError = function (err, msg) {
|
||||
const args = [err];
|
||||
try {
|
||||
// toString() can throw
|
||||
if (msg)
|
||||
args.unshift(`${msg}:`);
|
||||
} catch (e) {}
|
||||
|
||||
console.error(...args);
|
||||
};
|
||||
|
||||
// Chain up async errors reported from C
|
||||
global.connect('notify-error', (global, msg, detail) => {
|
||||
|
Loading…
Reference in New Issue
Block a user