[polari/wip/fmuellner/logging: 1/4] main: Make Utils.debug() globally available
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [polari/wip/fmuellner/logging: 1/4] main: Make Utils.debug() globally available
- Date: Sun, 9 Oct 2016 12:38:35 +0000 (UTC)
commit a92d82c5ad778e8faef9f94cd1cf89904b209d10
Author: Florian Müllner <fmuellner gnome org>
Date: Fri Sep 9 18:28:36 2016 +0200
main: Make Utils.debug() globally available
We should be more generous with logging debug messages, so make it a
tad bit more convenient by not requiring a special import.
https://bugzilla.gnome.org/show_bug.cgi?id=771218
src/application.js | 10 +++++-----
src/entryArea.js | 5 ++---
src/main.js | 2 ++
src/telepathyClient.js | 12 ++++++------
4 files changed, 15 insertions(+), 14 deletions(-)
---
diff --git a/src/application.js b/src/application.js
index d514ec0..898bff0 100644
--- a/src/application.js
+++ b/src/application.js
@@ -323,7 +323,7 @@ const Application = new Lang.Class({
let server = params['server'];
let accountName = params['account'];
let port = params['port'];
- Utils.debug('Failed to connect to %s with username %s'.format(server, accountName));
+ debug('Failed to connect to %s with username %s'.format(server, accountName));
let accountServers = [];
if (this._networksManager.getAccountIsPredefined(account))
@@ -367,7 +367,7 @@ const Application = new Lang.Class({
let oldParams = account.dup_parameters_vardict().deep_unpack();
let nick = oldParams['account'].deep_unpack();
- Utils.debug('Retrying with nickname %s'.format(nick + '_'));
+ debug('Retrying with nickname %s'.format(nick + '_'));
let params = { account: new GLib.Variant('s', nick + '_') };
this._retryWithParams(account, new GLib.Variant('a{sv}', params));
return true;
@@ -380,7 +380,7 @@ const Application = new Lang.Class({
if (!server)
return false;
- Utils.debug('Retrying with %s:%d'.format(server.address, server.port));
+ debug('Retrying with %s:%d'.format(server.address, server.port));
let params = { server: new GLib.Variant('s', server.address),
port: new GLib.Variant('u', server.port),
'use-ssl': new GLib.Variant('b', server.ssl) };
@@ -408,8 +408,8 @@ const Application = new Lang.Class({
if (reason != Tp.ConnectionStatusReason.REQUESTED) {
let strReasons = Object.keys(Tp.ConnectionStatusReason);
- Utils.debug('Account %s disconnected with reason %s'.format(
- account.display_name, strReasons[reason]));
+ debug('Account %s disconnected with reason %s'.format(
+ account.display_name, strReasons[reason]));
}
}
diff --git a/src/entryArea.js b/src/entryArea.js
index b1b8057..858e7e5 100644
--- a/src/entryArea.js
+++ b/src/entryArea.js
@@ -12,7 +12,6 @@ const Mainloop = imports.mainloop;
const TabCompletion = imports.tabCompletion;
const Tp = imports.gi.TelepathyGLib;
const PasteManager = imports.pasteManager;
-const Utils = imports.utils;
const MAX_NICK_UPDATE_TIME = 5; /* s */
const MAX_LINES = 5;
@@ -357,8 +356,8 @@ const EntryArea = new Lang.Class({
}));
} catch(e) {
let type = typeof this._pasteContent;
- Utils.debug('Failed to paste content of type ' +
- (type == 'object' ? this._pasteContent.toString() : type));
+ debug('Failed to paste content of type ' +
+ (type == 'object' ? this._pasteContent.toString() : type));
}
this._confirmLabel.hide();
},
diff --git a/src/main.js b/src/main.js
index 877cf9a..8ce3f07 100755
--- a/src/main.js
+++ b/src/main.js
@@ -10,6 +10,8 @@ pkg.require({ 'Gio': '2.0',
const Application = imports.application;
const GLib = imports.gi.GLib;
+window.debug = imports.utils.debug;
+
function main(args) {
let application = new Application.Application();
if (GLib.getenv('POLARI_PERSIST'))
diff --git a/src/telepathyClient.js b/src/telepathyClient.js
index bdf24e6..5a9d504 100644
--- a/src/telepathyClient.js
+++ b/src/telepathyClient.js
@@ -77,7 +77,7 @@ const SASLAuthHandler = new Lang.Class({
_onSASLStatusChanged: function(proxy, sender, [status]) {
let name = this._channel.connection.get_account().display_name;
let statusString = (Object.keys(SASLStatus))[status];
- Utils.debug('Auth status for server "%s": %s'.format(name, statusString));
+ debug('Auth status for server "%s": %s'.format(name, statusString));
switch(status) {
case SASLStatus.NOT_STARTED:
@@ -202,8 +202,8 @@ const TelepathyClient = new Lang.Class({
let connected = this._networkMonitor.network_available;
let presence = connected ? Tp.ConnectionPresenceType.AVAILABLE
: Tp.ConnectionPresenceType.OFFLINE;
- Utils.debug('Network changed to %s'.format(connected ? 'available'
- : 'unavailable'));
+ debug('Network changed to %s'.format(connected ? 'available'
+ : 'unavailable'));
this._accountsMonitor.enabledAccounts.forEach(a => {
if (a.presence_type == Tp.ConnectionPresenceType.AVAILABLE &&
@@ -238,8 +238,8 @@ const TelepathyClient = new Lang.Class({
let msg = account.requested_status_message;
let accountName = account.display_name;
- Utils.debug('Setting presence of account "%s" to %s'.format(accountName,
- status));
+ debug('Setting presence of account "%s" to %s'.format(accountName,
+ status));
account.request_presence_async(presence, status, msg, (o, res) => {
try {
account.request_presence_finish(res);
@@ -285,7 +285,7 @@ const TelepathyClient = new Lang.Class({
try {
channel = req.ensure_and_observe_channel_finish(res);
} catch(e) {
- Utils.debug('Failed to ensure channel: ' + e.message);
+ debug('Failed to ensure channel: ' + e.message);
}
if (callback)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]