[gnome-shell] js: Don't use global.log*



commit ce041a3190e10d977472e0a4d8dabdd5af96d569
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Wed May 9 22:37:42 2012 -0300

    js: Don't use global.log*
    
    These are "deprecated", and are just references to the gjs logging functoins
    
    https://bugzilla.gnome.org/show_bug.cgi?id=675790

 js/extensionPrefs/main.js |    4 ++--
 js/misc/extensionUtils.js |    6 +++---
 js/ui/extensionSystem.js  |    4 ++--
 js/ui/main.js             |    3 ++-
 js/ui/search.js           |    4 ++--
 5 files changed, 11 insertions(+), 10 deletions(-)
---
diff --git a/js/extensionPrefs/main.js b/js/extensionPrefs/main.js
index 921bfe6..59bf6cb 100644
--- a/js/extensionPrefs/main.js
+++ b/js/extensionPrefs/main.js
@@ -210,7 +210,7 @@ const Application = new Lang.Class({
             try {
                 extension = ExtensionUtils.createExtensionObject(uuid, dir, type);
             } catch(e) {
-                global.logError('' + e);
+                logError(e, 'Could not create extensions object');
                 return;
             }
 
@@ -257,7 +257,7 @@ function initEnvironment() {
         },
 
         logError: function(s) {
-            global.log('ERROR: ' + s);
+            log('ERROR: ' + s);
         },
 
         userdatadir: GLib.build_filenamev([GLib.get_user_data_dir(), 'gnome-shell'])
diff --git a/js/misc/extensionUtils.js b/js/misc/extensionUtils.js
index 7dcf166..82ded01 100644
--- a/js/misc/extensionUtils.js
+++ b/js/misc/extensionUtils.js
@@ -120,7 +120,7 @@ function createExtensionObject(uuid, dir, type) {
 
     // Encourage people to add this
     if (!meta.url) {
-        global.log('Warning: Missing "url" property in metadata.json');
+        log('Warning: Missing "url" property in %s/metadata.json'.format(uuid));
     }
 
     if (uuid != meta.uuid) {
@@ -157,7 +157,7 @@ function init() {
         if (!userExtensionsDir.query_exists(null))
             userExtensionsDir.make_directory_with_parents(null);
     } catch (e) {
-        global.logError('' + e);
+        logError(e, 'Could not create extensions directory');
     }
 }
 
@@ -167,7 +167,7 @@ function scanExtensionsInDirectory(callback, dir, type) {
     try {
         fileEnum = dir.enumerate_children('standard::*', Gio.FileQueryInfoFlags.NONE, null);
     } catch(e) {
-        global.logError('' + e);
+        logError(e, 'Could not enumerate extensions directory');
         return;
     }
 
diff --git a/js/ui/extensionSystem.js b/js/ui/extensionSystem.js
index 2fa30db..fe092d2 100644
--- a/js/ui/extensionSystem.js
+++ b/js/ui/extensionSystem.js
@@ -237,7 +237,7 @@ function logExtensionError(uuid, message, state) {
         extension.errors = [];
 
     extension.errors.push(message);
-    global.logError('Extension "%s" had error: %s'.format(uuid, message));
+    log('Extension "%s" had error: %s'.format(uuid, message));
     state = state || ExtensionState.ERROR;
     _signals.emit('extension-state-changed', { uuid: uuid,
                                                error: message,
@@ -249,7 +249,7 @@ function loadExtension(dir, type, enabled) {
     let extension;
 
     if (ExtensionUtils.extensions[uuid] != undefined) {
-        global.logError('Extension "%s" is already loaded'.format(uuid));
+        log('Extension "%s" is already loaded'.format(uuid));
         return;
     }
 
diff --git a/js/ui/main.js b/js/ui/main.js
index f179594..f7f46c2 100644
--- a/js/ui/main.js
+++ b/js/ui/main.js
@@ -875,7 +875,8 @@ function initializeDeferredWork(actor, callback, props) {
 function queueDeferredWork(workId) {
     let data = _deferredWorkData[workId];
     if (!data) {
-        global.logError('invalid work id ', workId);
+        let message = 'Invalid work id %d'.format(workId);
+        logError(new Error(message), message);
         return;
     }
     if (_deferredWorkQueue.indexOf(workId) < 0)
diff --git a/js/ui/search.js b/js/ui/search.js
index c6fc02e..86255fa 100644
--- a/js/ui/search.js
+++ b/js/ui/search.js
@@ -354,7 +354,7 @@ const SearchSystem = new Lang.Class({
                     results.push([provider, []]);
                     provider.getSubsearchResultSet(previousResults, terms);
                 } catch (error) {
-                    global.log ('A ' + error.name + ' has occured in ' + provider.title + ': ' + error.message);
+                    log('A ' + error.name + ' has occured in ' + provider.title + ': ' + error.message);
                 }
             }
         } else {
@@ -364,7 +364,7 @@ const SearchSystem = new Lang.Class({
                     results.push([provider, []]);
                     provider.getInitialResultSet(terms);
                 } catch (error) {
-                    global.log ('A ' + error.name + ' has occured in ' + provider.title + ': ' + error.message);
+                    log('A ' + error.name + ' has occured in ' + provider.title + ': ' + error.message);
                 }
             }
         }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]