Skip to content

Commit 5c19126

Browse files
committed
Added logging. Update underlying gtt library. closes kriskbx#3
1 parent 554e421 commit 5c19126

File tree

3 files changed

+21
-12
lines changed

3 files changed

+21
-12
lines changed

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,8 @@
9191
"chokidar": "^2.0.0",
9292
"electron": "1.8.4",
9393
"electron-compile": "^6.4.2",
94-
"gitlab-time-tracker": "^1.7.6",
94+
"electron-log": "^2.2.14",
95+
"gitlab-time-tracker": "^1.7.7",
9596
"moment": "^2.20.1",
9697
"write-yaml": "^1.0.0"
9798
},

src/index.js

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ const chokidar = require('chokidar');
1010
const os = require('os');
1111

1212
const moment = require('moment');
13+
var log = require('electron-log');
1314

1415
let gtt = new events.EventEmitter(),
1516
trayIcon = null,
@@ -204,7 +205,10 @@ gtt.setTray = () => {
204205

205206
if (gtt._platform == 'linux') {
206207
let contextMenu = Menu.buildFromTemplate([
207-
{label: 'Open GTT', click: gtt.toggleTrayWindow},
208+
{label: 'Open GTT', click: (d1, d2, d3) => {
209+
console.log(d1,d2,d3);
210+
gtt.toggleTrayWindow
211+
}},
208212
{label: 'Quit', click: app.quit}
209213
]);
210214
trayIcon.setContextMenu(contextMenu);
@@ -381,7 +385,7 @@ gtt.cache = {
381385
* @private
382386
*/
383387
gtt._dump = (msg) => {
384-
if (debug) console.log(`${moment().format('YYYY-MM-DD HH:mm:ss.SSS')} GTT ${msg}`)
388+
log.info(msg);
385389
};
386390

387391
gtt._send = (key, val) => {
@@ -430,12 +434,12 @@ gtt._handleError = error => {
430434
if (error.statusCode === 401 && !gtt._unauthorized) {
431435
gtt._unauthorized = true;
432436
if (dialog.showMessageBox(null, {
433-
type: "warning",
434-
title: "Unauthorized",
435-
message: "Cannot connect to GitLab: unauthorized.",
436-
detail: "If this is the first time you start gtt, open the preferences and add your GitLab API token.",
437-
buttons: ["Go to preferences now", "I'll do it later"]
438-
}) === 0) gtt.openSettingsWindow();
437+
type: "warning",
438+
title: "Unauthorized",
439+
message: "Cannot connect to GitLab: unauthorized.",
440+
detail: "If this is the first time you start gtt, open the preferences and add your GitLab API token.",
441+
buttons: ["Go to preferences now", "I'll do it later"]
442+
}) === 0) gtt.openSettingsWindow();
439443
}
440444
};
441445

yarn.lock

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3275,6 +3275,10 @@ electron-installer-redhat@^0.5.0:
32753275
word-wrap "^1.2.1"
32763276
yargs "7.0.2"
32773277

3278+
electron-log@^2.2.14:
3279+
version "2.2.14"
3280+
resolved "https://registry.yarnpkg.com/electron-log/-/electron-log-2.2.14.tgz#2123319ccb8d70b0db07f0eda57d5823cb42b4b0"
3281+
32783282
electron-osx-sign@^0.4.1:
32793283
version "0.4.10"
32803284
resolved "https://registry.yarnpkg.com/electron-osx-sign/-/electron-osx-sign-0.4.10.tgz#be4f3b89b2a75a1dc5f1e7249081ab2929ca3a26"
@@ -4617,9 +4621,9 @@ github-api-emojis@^1.0.1:
46174621
version "1.0.2"
46184622
resolved "https://registry.yarnpkg.com/github-api-emojis/-/github-api-emojis-1.0.2.tgz#c3664164b915fc65c047c416d5d4a73a637e45a9"
46194623

4620-
gitlab-time-tracker@^1.7.6:
4621-
version "1.7.6"
4622-
resolved "https://registry.yarnpkg.com/gitlab-time-tracker/-/gitlab-time-tracker-1.7.6.tgz#2bc728e4f93b37755aac0432576f1c853ed5443a"
4624+
gitlab-time-tracker@^1.7.7:
4625+
version "1.7.7"
4626+
resolved "https://registry.yarnpkg.com/gitlab-time-tracker/-/gitlab-time-tracker-1.7.7.tgz#a2b380d78261e4a4adfc94b995ebf0ebc2eab229"
46234627
dependencies:
46244628
async "^2.4.0"
46254629
camelcase "^4.1.0"

0 commit comments

Comments
 (0)