environment: Remove inline import of extensionUtils
The logging function cannot be asynchronous, so move the override into main.js where ExtensionUtils can be imported at the top level. Importing ExtensionUtils in environment.js at the top level is not possible because it would import Main prematurely. Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2363>
This commit is contained in:
@ -316,27 +316,10 @@ function _easeActorProperty(actor, propName, target, params) {
|
||||
transition.connect('stopped', (t, finished) => callback(finished));
|
||||
}
|
||||
|
||||
function _loggingFunc(...args) {
|
||||
let fields = { 'MESSAGE': args.join(', ') };
|
||||
let domain = "GNOME Shell";
|
||||
|
||||
// If the caller is an extension, add it as metadata
|
||||
let extension = imports.misc.extensionUtils.getCurrentExtension();
|
||||
if (extension != null) {
|
||||
domain = extension.metadata.name;
|
||||
fields['GNOME_SHELL_EXTENSION_UUID'] = extension.uuid;
|
||||
fields['GNOME_SHELL_EXTENSION_NAME'] = extension.metadata.name;
|
||||
}
|
||||
|
||||
GLib.log_structured(domain, GLib.LogLevelFlags.LEVEL_MESSAGE, fields);
|
||||
}
|
||||
|
||||
function init() {
|
||||
// Add some bindings to the global JS namespace
|
||||
globalThis.global = Shell.Global.get();
|
||||
|
||||
globalThis.log = _loggingFunc;
|
||||
|
||||
globalThis._ = Gettext.gettext;
|
||||
globalThis.C_ = Gettext.pgettext;
|
||||
globalThis.ngettext = Gettext.ngettext;
|
||||
|
Reference in New Issue
Block a user