From 5dc6327fda780ea34906fa5fa7055ccf1abf6baf Mon Sep 17 00:00:00 2001 From: Jiiks Date: Fri, 4 Nov 2016 06:46:02 +0200 Subject: [PATCH 1/6] Loggers --- v2/src/js/utils.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/v2/src/js/utils.js b/v2/src/js/utils.js index 05826968..84e3ff36 100644 --- a/v2/src/js/utils.js +++ b/v2/src/js/utils.js @@ -13,6 +13,22 @@ define(() => { class Utils { + constructor() { + + } + + log(msg) { + console.log(`%c[%cBetterDiscord|INF%c] %c${msg}`, 'color: #000;', 'color: green; font-weight:#000;', 'color:#00;', ''); + } + + warn(msg) { + console.log(`%c[%cBetterDiscord|WRN%c] %c${msg}`, 'color: #000;', 'color: orange; font-weight:700;', 'color:#000;', ''); + } + + err(msg) { + console.log(`%c[%cBetterDiscord|ERR%c] %c${msg}`, 'color: #000;', 'color: red; font-weight:700;', 'color:#000;', ''); + } + } return new Utils(); From 48e55c9417687abedeb708560116d976fe4336c3 Mon Sep 17 00:00:00 2001 From: Jiiks Date: Fri, 4 Nov 2016 06:49:51 +0200 Subject: [PATCH 2/6] Timestamps and init log --- v2/src/js/core.js | 4 ++-- v2/src/js/utils.js | 14 +++++++++++--- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/v2/src/js/core.js b/v2/src/js/core.js index e28f6c62..8da3da7e 100644 --- a/v2/src/js/core.js +++ b/v2/src/js/core.js @@ -20,7 +20,7 @@ define([ class Core { constructor(args) { - console.log(event); + this.utils = utils; this.event = event; this.modules = modules; this.beta = true; @@ -29,7 +29,7 @@ define([ } init() { - console.log("Initialized"); + utils.log(`${this.__versionString} Initializing`); } get __version() { diff --git a/v2/src/js/utils.js b/v2/src/js/utils.js index 84e3ff36..ad170377 100644 --- a/v2/src/js/utils.js +++ b/v2/src/js/utils.js @@ -18,15 +18,23 @@ define(() => { } log(msg) { - console.log(`%c[%cBetterDiscord|INF%c] %c${msg}`, 'color: #000;', 'color: green; font-weight:#000;', 'color:#00;', ''); + console.log(`[${this.timeString}]%c[%cBetterDiscord|INF%c] %c${msg}`, 'color: #000;', 'color: green; font-weight:#000;', 'color:#00;', ''); } warn(msg) { - console.log(`%c[%cBetterDiscord|WRN%c] %c${msg}`, 'color: #000;', 'color: orange; font-weight:700;', 'color:#000;', ''); + console.log(`[${this.timeString}]%c[%cBetterDiscord|WRN%c] %c${msg}`, 'color: #000;', 'color: orange; font-weight:700;', 'color:#000;', ''); } err(msg) { - console.log(`%c[%cBetterDiscord|ERR%c] %c${msg}`, 'color: #000;', 'color: red; font-weight:700;', 'color:#000;', ''); + console.log(`[${this.timeString}]%c[%cBetterDiscord|ERR%c] %c${msg}`, 'color: #000;', 'color: red; font-weight:700;', 'color:#000;', ''); + } + + get dateString() { + return new Date().toLocaleString("en-GB"); + } + + get timeString() { + return new Date().toTimeString().split(' ')[0]; } } From 1bb83de279f78ea26e777534c32bef80605d718b Mon Sep 17 00:00:00 2001 From: Jiiks Date: Fri, 4 Nov 2016 06:51:56 +0200 Subject: [PATCH 3/6] Reformatted logs --- v2/dist/js/main.js | 47 ++++++++++++++++++++++++++++++++++++++++------ v2/src/js/utils.js | 6 +++--- 2 files changed, 44 insertions(+), 9 deletions(-) diff --git a/v2/dist/js/main.js b/v2/dist/js/main.js index 1168491a..211da45a 100644 --- a/v2/dist/js/main.js +++ b/v2/dist/js/main.js @@ -55,9 +55,44 @@ return modules; }(src_js_modules_observermodule); src_js_utils = function () { - var Utils = function Utils() { - _classCallCheck(this, Utils); - }; + var Utils = function () { + function Utils() { + _classCallCheck(this, Utils); + } + _createClass(Utils, [ + { + key: 'log', + value: function log(msg) { + console.log('[' + this.timeString + ']%c[%cBetterDiscord%c] %c' + msg, 'color: #000;', 'color: green; font-weight:#000;', 'color:#00;', ''); + } + }, + { + key: 'warn', + value: function warn(msg) { + console.log('[' + this.timeString + ']%c[%cBetterDiscord%c] %c' + msg, 'color: #000;', 'color: orange; font-weight:700;', 'color:#000;', ''); + } + }, + { + key: 'err', + value: function err(msg) { + console.log('[' + this.timeString + ']%c[%cBetterDiscord%c] %c' + msg, 'color: #000;', 'color: red; font-weight:700;', 'color:#000;', ''); + } + }, + { + key: 'dateString', + get: function get() { + return new Date().toLocaleString('en-GB'); + } + }, + { + key: 'timeString', + get: function get() { + return new Date().toTimeString().split(' ')[0]; + } + } + ]); + return Utils; + }(); return new Utils(); }(); src_js_api = function () { @@ -97,7 +132,7 @@ return Plugin; }(); src_js_event = function () { - var EventEmitter = events.EventEmitter; + var EventEmitter = new require('events').EventEmitter; var Event = function () { function Event() { _classCallCheck(this, Event); @@ -126,7 +161,7 @@ var Core = function () { function Core(args) { _classCallCheck(this, Core); - console.log(event); + this.utils = utils; this.event = event; this.modules = modules; this.beta = true; @@ -137,7 +172,7 @@ { key: 'init', value: function init() { - console.log('Initialized'); + utils.log(this.__versionString + ' Initializing'); } }, { diff --git a/v2/src/js/utils.js b/v2/src/js/utils.js index ad170377..82dd9d95 100644 --- a/v2/src/js/utils.js +++ b/v2/src/js/utils.js @@ -18,15 +18,15 @@ define(() => { } log(msg) { - console.log(`[${this.timeString}]%c[%cBetterDiscord|INF%c] %c${msg}`, 'color: #000;', 'color: green; font-weight:#000;', 'color:#00;', ''); + console.log(`[${this.timeString}]%c[%cBetterDiscord%c] %c${msg}`, 'color: #000;', 'color: green; font-weight:#000;', 'color:#00;', ''); } warn(msg) { - console.log(`[${this.timeString}]%c[%cBetterDiscord|WRN%c] %c${msg}`, 'color: #000;', 'color: orange; font-weight:700;', 'color:#000;', ''); + console.log(`[${this.timeString}]%c[%cBetterDiscord%c] %c${msg}`, 'color: #000;', 'color: orange; font-weight:700;', 'color:#000;', ''); } err(msg) { - console.log(`[${this.timeString}]%c[%cBetterDiscord|ERR%c] %c${msg}`, 'color: #000;', 'color: red; font-weight:700;', 'color:#000;', ''); + console.log(`[${this.timeString}]%c[%cBetterDiscord%c] %c${msg}`, 'color: #000;', 'color: red; font-weight:700;', 'color:#000;', ''); } get dateString() { From 821a9f8749e67482046559c8558c956ea8bdc43a Mon Sep 17 00:00:00 2001 From: Jiiks Date: Fri, 4 Nov 2016 07:03:39 +0200 Subject: [PATCH 4/6] Reformatted logger again --- v2/dist/js/main.js | 6 +++--- v2/src/js/utils.js | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/v2/dist/js/main.js b/v2/dist/js/main.js index 211da45a..75aff898 100644 --- a/v2/dist/js/main.js +++ b/v2/dist/js/main.js @@ -63,19 +63,19 @@ { key: 'log', value: function log(msg) { - console.log('[' + this.timeString + ']%c[%cBetterDiscord%c] %c' + msg, 'color: #000;', 'color: green; font-weight:#000;', 'color:#00;', ''); + console.log('%c[BD] %cINF >> %c' + msg, 'color:#3e82e5; font-weight:700', 'color:green; font-weight:700', ''); } }, { key: 'warn', value: function warn(msg) { - console.log('[' + this.timeString + ']%c[%cBetterDiscord%c] %c' + msg, 'color: #000;', 'color: orange; font-weight:700;', 'color:#000;', ''); + console.log('%c[BD] %cWRN >> %c' + msg, 'color:#3e82e5; font-weight:700', 'color:orange; font-weight:700', ''); } }, { key: 'err', value: function err(msg) { - console.log('[' + this.timeString + ']%c[%cBetterDiscord%c] %c' + msg, 'color: #000;', 'color: red; font-weight:700;', 'color:#000;', ''); + console.log('%c[BD] %cERR >> %c' + msg, 'color:#3e82e5; font-weight:700', 'color:red; font-weight:700', ''); } }, { diff --git a/v2/src/js/utils.js b/v2/src/js/utils.js index 82dd9d95..fa253144 100644 --- a/v2/src/js/utils.js +++ b/v2/src/js/utils.js @@ -18,15 +18,15 @@ define(() => { } log(msg) { - console.log(`[${this.timeString}]%c[%cBetterDiscord%c] %c${msg}`, 'color: #000;', 'color: green; font-weight:#000;', 'color:#00;', ''); + console.log(`%c[BD] %cINF >> %c${msg}`, 'color:#3e82e5; font-weight:700', 'color:green; font-weight:700', '') } warn(msg) { - console.log(`[${this.timeString}]%c[%cBetterDiscord%c] %c${msg}`, 'color: #000;', 'color: orange; font-weight:700;', 'color:#000;', ''); + console.log(`%c[BD] %cWRN >> %c${msg}`, 'color:#3e82e5; font-weight:700', 'color:orange; font-weight:700', '') } err(msg) { - console.log(`[${this.timeString}]%c[%cBetterDiscord%c] %c${msg}`, 'color: #000;', 'color: red; font-weight:700;', 'color:#000;', ''); + console.log(`%c[BD] %cERR >> %c${msg}`, 'color:#3e82e5; font-weight:700', 'color:red; font-weight:700', '') } get dateString() { From 0b614022adf1e00a234cb4e2ec721c720a29d941 Mon Sep 17 00:00:00 2001 From: Jiiks Date: Fri, 4 Nov 2016 07:11:22 +0200 Subject: [PATCH 5/6] Final logger format maybe --- v2/dist/js/main.js | 12 +++++++++--- v2/src/js/utils.js | 12 ++++++++---- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/v2/dist/js/main.js b/v2/dist/js/main.js index 75aff898..76385f2f 100644 --- a/v2/dist/js/main.js +++ b/v2/dist/js/main.js @@ -63,19 +63,25 @@ { key: 'log', value: function log(msg) { - console.log('%c[BD] %cINF >> %c' + msg, 'color:#3e82e5; font-weight:700', 'color:green; font-weight:700', ''); + console.log('%c[BD] %c>> %c' + msg, 'color:#3e82e5; font-weight:700', 'color:#000; font-weight:700', ''); + } + }, + { + key: 'info', + value: function info(msg) { + console.info('%c[BD] %c>> %c' + msg, 'color:#3e82e5; font-weight:700', 'color:blue; font-weight:700', ''); } }, { key: 'warn', value: function warn(msg) { - console.log('%c[BD] %cWRN >> %c' + msg, 'color:#3e82e5; font-weight:700', 'color:orange; font-weight:700', ''); + console.warn('%c[BD] %c>> %c' + msg, 'color:#3e82e5; font-weight:700', 'color:orange; font-weight:700', ''); } }, { key: 'err', value: function err(msg) { - console.log('%c[BD] %cERR >> %c' + msg, 'color:#3e82e5; font-weight:700', 'color:red; font-weight:700', ''); + console.error('%c[BD] %c>> %c' + msg, 'color:#3e82e5; font-weight:700', 'color:red; font-weight:700', ''); } }, { diff --git a/v2/src/js/utils.js b/v2/src/js/utils.js index fa253144..11095716 100644 --- a/v2/src/js/utils.js +++ b/v2/src/js/utils.js @@ -1,7 +1,7 @@ /* BetterDiscordApp Client Utilities * Version: 2:1.0 * Author: Jiiks | https://jiiks.net - * Date: 31/10/2016 + * Date: 04/11/2016 * Last Update: 31/10/2016 * Github: https://github.com/Jiiks/BetterDiscordApp * Git: https://github.com/Jiiks/BetterDiscordApp.git @@ -18,15 +18,19 @@ define(() => { } log(msg) { - console.log(`%c[BD] %cINF >> %c${msg}`, 'color:#3e82e5; font-weight:700', 'color:green; font-weight:700', '') + console.log(`%c[BD] %c>> %c${msg}`, 'color:#3e82e5; font-weight:700', 'color:#000; font-weight:700', '') + } + + info(msg) { + console.info(`%c[BD] %c>> %c${msg}`, 'color:#3e82e5; font-weight:700', 'color:blue; font-weight:700', '') } warn(msg) { - console.log(`%c[BD] %cWRN >> %c${msg}`, 'color:#3e82e5; font-weight:700', 'color:orange; font-weight:700', '') + console.warn(`%c[BD] %c>> %c${msg}`, 'color:#3e82e5; font-weight:700', 'color:orange; font-weight:700', '') } err(msg) { - console.log(`%c[BD] %cERR >> %c${msg}`, 'color:#3e82e5; font-weight:700', 'color:red; font-weight:700', '') + console.error(`%c[BD] %c>> %c${msg}`, 'color:#3e82e5; font-weight:700', 'color:red; font-weight:700', '') } get dateString() { From a1f9f291987dcbc5994b7b4250dadf7fa9726bf3 Mon Sep 17 00:00:00 2001 From: Jiiks Date: Fri, 4 Nov 2016 07:11:52 +0200 Subject: [PATCH 6/6] Changed info arrow colour --- v2/src/js/utils.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/v2/src/js/utils.js b/v2/src/js/utils.js index 11095716..146c5855 100644 --- a/v2/src/js/utils.js +++ b/v2/src/js/utils.js @@ -22,7 +22,7 @@ define(() => { } info(msg) { - console.info(`%c[BD] %c>> %c${msg}`, 'color:#3e82e5; font-weight:700', 'color:blue; font-weight:700', '') + console.info(`%c[BD] %c>> %c${msg}`, 'color:#3e82e5; font-weight:700', 'color:#3e82e5; font-weight:700', '') } warn(msg) {