From 0205686302823d97781fd6485e9545fee811a475 Mon Sep 17 00:00:00 2001 From: Guillaume Wuip Date: Mon, 22 Dec 2014 18:56:52 +0100 Subject: [PATCH 1/5] Fix jshint error --- lib/console2.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/console2.js b/lib/console2.js index 29bcebd..3b66046 100644 --- a/lib/console2.js +++ b/lib/console2.js @@ -86,7 +86,9 @@ length = 0; tags.forEach(function (tag) { - if(typeof tag === "undefined" || tag === null) return; + if(typeof tag === "undefined" || tag === null) { + return; + } if (typeof tag === 'object') { result += applyColors('[' + tag.msg + ']', tag.colors); length += tag.msg.toString().length + 2; From bedbd68a0622c6506b13a187369891217fcdb3e6 Mon Sep 17 00:00:00 2001 From: Guillaume Wuip Date: Mon, 22 Dec 2014 18:58:14 +0100 Subject: [PATCH 2/5] Move private function geSpace() up and add doc --- lib/console2.js | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/lib/console2.js b/lib/console2.js index 3b66046..28d9262 100644 --- a/lib/console2.js +++ b/lib/console2.js @@ -175,6 +175,26 @@ return msg; }; + /** + * spaceLUT + * + * Save offset space strings + */ + var spaceLUT = {}; + + /** + * getSpaces + * + * @param {int} offset + * @return {String} A string of [offset] space + */ + var getSpaces = function(offset){ + if(typeof spaceLUT[offset] === "undefined"){ + spaceLUT[offset] = new Array(offset).join(' '); + } + return spaceLUT[offset]; + }; + /* * Console2 * @@ -344,14 +364,6 @@ return this; }; - var spaceLUT = {}; - var getSpaces = function(offset){ - if(typeof spaceLUT[offset] === "undefined"){ - spaceLUT[offset] = new Array(offset).join(' '); - } - return spaceLUT[offset]; - } - /** * Console2.prototype.buildArgs * From 717ea28dfc8ffbab753329c4c0536d7e0bf6c328 Mon Sep 17 00:00:00 2001 From: Guillaume Wuip Date: Mon, 22 Dec 2014 19:54:37 +0100 Subject: [PATCH 3/5] Add 2px space between log rows --- static/style.css | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/static/style.css b/static/style.css index 00b3bf6..6543c18 100644 --- a/static/style.css +++ b/static/style.css @@ -452,10 +452,9 @@ body { } .log__item { display: table-cell; - padding: 0 6px; - - padding-right: 6px; text-align: left; + padding-bottom: 2px; + padding-right: 6px; padding-left: 0; } .log__tags { From 769dffe77d39324eceee849d9399f84f48319126 Mon Sep 17 00:00:00 2001 From: Guillaume Wuip Date: Mon, 22 Dec 2014 22:00:40 +0100 Subject: [PATCH 4/5] Add collapse log options --- static/js/directives/log.js | 57 +++++++++++++++++++++++-------- static/partials/elements/log.html | 17 +++++++-- static/style.css | 25 ++++++++++---- 3 files changed, 75 insertions(+), 24 deletions(-) diff --git a/static/js/directives/log.js b/static/js/directives/log.js index 1542897..147081c 100644 --- a/static/js/directives/log.js +++ b/static/js/directives/log.js @@ -9,7 +9,7 @@ */ window.app.directive('log', [function () { - + return { scope : { @@ -23,38 +23,38 @@ /** * showFile - * + * * Force to show file ? * - * @type {Boolean} - */ + * @type {Boolean} + */ showFile : "=", /** * showTime - * + * * Force to show time ? * - * @type {Boolean} - */ + * @type {Boolean} + */ showTime : "=", /** * showDate - * + * * Force to show date ? * - * @type {Boolean} - */ + * @type {Boolean} + */ showDate : "=", /** * showTags - * + * * Force to show tags ? * - * @type {Boolean} - */ + * @type {Boolean} + */ showTags : "=" }, restrict : 'E', @@ -78,14 +78,41 @@ } else if (typeof tag === 'object') { return tag.msg || ''; } else { - return tag; + return tag; } }; + /** + * scope.collapse + * + * @type {Boolean} True to collapse the log + */ + $scope.collapse = false; + + /** + * $scope.changeState + */ + $scope.changeState = function () { + $scope.collapse = !$scope.collapse; + }; + + /** + * $scope.isMultilines + * + * @return {Boolean} true if log is multilines + */ + $scope.isMultilines = function () { + if ($scope.log.hasOwnProperty('argsString')) { + return (/\n/).test($scope.log.argsString); + } else { + return (/\n/).test($scope.log); + } + }; + }] }; - + }]); diff --git a/static/partials/elements/log.html b/static/partials/elements/log.html index c7d3e79..6691f53 100644 --- a/static/partials/elements/log.html +++ b/static/partials/elements/log.html @@ -1,4 +1,11 @@ -

+

+ + + + + + + @@ -22,8 +29,12 @@ - {{log.argsString}} + + {{log.argsString}} + - {{log}} + + {{log}} +

diff --git a/static/style.css b/static/style.css index 6543c18..4e5ca17 100644 --- a/static/style.css +++ b/static/style.css @@ -456,14 +456,21 @@ body { padding-bottom: 2px; padding-right: 6px; padding-left: 0; +} + .log__collapse { + font-size: 12px; +} + .log__collapse > span { + display: block; + width: 12px; /* fix size between states */ + padding: 2px 4px; + cursor: pointer; } .log__tags { background: #111; } - .log__tag {} - .log__time { - background: #111; -} + .log__collapse, + .log__time, .log__location { background: #111; } @@ -471,8 +478,6 @@ body { color: #2980b9; } .log__message { - white-space: pre; - color: #FFF; line-height: 13px; /* margin-top: -10px; */ @@ -481,6 +486,14 @@ body { border-left: 1px solid #222; /* box-shadow: inset 2px 0 2px -2px #000; */ padding-left: 6px; +} + .log__message > span { + display: block; + overflow: hidden; + white-space: pre; +} + .log--collapse .log__message > span { + height : 15px; } .log__json { white-space: pre-wrap; From e61c249c9ca9d179d65f8f93c2ea6a3ab4a62288 Mon Sep 17 00:00:00 2001 From: Guillaume Wuip Date: Mon, 22 Dec 2014 22:06:12 +0100 Subject: [PATCH 5/5] Add line number --- static/js/directives/log.js | 8 ++++++++ static/partials/elements/log.html | 4 ++++ static/partials/logs.html | 1 + static/style.css | 17 +++++++++++------ 4 files changed, 24 insertions(+), 6 deletions(-) diff --git a/static/js/directives/log.js b/static/js/directives/log.js index 147081c..25710b3 100644 --- a/static/js/directives/log.js +++ b/static/js/directives/log.js @@ -21,6 +21,14 @@ */ log : "=", + /** + * number + * + * Line number + * @type {Int} + */ + number : "=", + /** * showFile * diff --git a/static/partials/elements/log.html b/static/partials/elements/log.html index 6691f53..b82a7d8 100644 --- a/static/partials/elements/log.html +++ b/static/partials/elements/log.html @@ -1,5 +1,9 @@

+ + {{number}} + + diff --git a/static/partials/logs.html b/static/partials/logs.html index 4aa221a..670675f 100644 --- a/static/partials/logs.html +++ b/static/partials/logs.html @@ -8,6 +8,7 @@ span { color: #2980b9;