Return-Path: X-Original-To: apmail-couchdb-commits-archive@www.apache.org Delivered-To: apmail-couchdb-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 3C37011EFF for ; Sat, 7 Jun 2014 21:04:26 +0000 (UTC) Received: (qmail 56648 invoked by uid 500); 7 Jun 2014 21:04:25 -0000 Delivered-To: apmail-couchdb-commits-archive@couchdb.apache.org Received: (qmail 56450 invoked by uid 500); 7 Jun 2014 21:04:25 -0000 Mailing-List: contact commits-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@couchdb.apache.org Delivered-To: mailing list commits@couchdb.apache.org Received: (qmail 56340 invoked by uid 99); 7 Jun 2014 21:04:25 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 07 Jun 2014 21:04:25 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 4F457462ED; Sat, 7 Jun 2014 21:04:25 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: kxepal@apache.org To: commits@couchdb.apache.org Date: Sat, 07 Jun 2014 21:04:31 -0000 Message-Id: <987bf14d664046a0900931e2ee79c31f@git.apache.org> In-Reply-To: <18ae056366f1449bbf3a8bd1b9e9262b@git.apache.org> References: <18ae056366f1449bbf3a8bd1b9e9262b@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [07/15] fauxton commit: updated refs/heads/import-master to 8cb432c Fauxton: remove the Log Component As prepration for the BigCouch merge and a LTS Couch 1.x with Fauxton. After the merge the _logs resource will not be available and logging happens with Lager. See http://www.mail-archive.com/dev@couchdb.apache.org/msg32934.html for more details. Project: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/repo Commit: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/commit/35a839db Tree: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/tree/35a839db Diff: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/diff/35a839db Branch: refs/heads/import-master Commit: 35a839db2732e4d59601a9d175ca4011c9ce42e4 Parents: f968009 Author: Robert Kowalski Authored: Wed May 28 20:34:02 2014 +0200 Committer: Robert Kowalski Committed: Thu May 29 12:07:25 2014 +0200 ---------------------------------------------------------------------- TODO.md | 2 - app/addons/logs/assets/less/logs.less | 24 --- app/addons/logs/base.js | 28 ---- app/addons/logs/resources.js | 212 -------------------------- app/addons/logs/routes.js | 58 ------- app/addons/logs/templates/dashboard.html | 50 ------ app/addons/logs/templates/sidebar.html | 18 --- app/addons/logs/tests/baseSpec.js | 38 ----- app/addons/logs/tests/resourcesSpec.js | 117 -------------- assets/less/fauxton.less | 6 - settings.json.default | 1 - settings.json.dev | 1 - 12 files changed, 555 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/35a839db/TODO.md ---------------------------------------------------------------------- diff --git a/TODO.md b/TODO.md index b929e05..a4b2a8e 100644 --- a/TODO.md +++ b/TODO.md @@ -21,6 +21,4 @@ In no particular order - [ ] replicate UI - [x] delete database - [x] format dates better (e.g. in logs plugin) -- [ ] format log entry better -- [ ] filter logs by method - [ ] restore unfiltered data in logs UI http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/35a839db/app/addons/logs/assets/less/logs.less ---------------------------------------------------------------------- diff --git a/app/addons/logs/assets/less/logs.less b/app/addons/logs/assets/less/logs.less deleted file mode 100644 index 17a4182..0000000 --- a/app/addons/logs/assets/less/logs.less +++ /dev/null @@ -1,24 +0,0 @@ -/* Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ - -.logs { - padding: 0 15px; - .log-table { - width: auto; - white-space: nowrap; - .args { - width: 100%; - white-space: normal; - } - } -} http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/35a839db/app/addons/logs/base.js ---------------------------------------------------------------------- diff --git a/app/addons/logs/base.js b/app/addons/logs/base.js deleted file mode 100644 index 1aecbdf..0000000 --- a/app/addons/logs/base.js +++ /dev/null @@ -1,28 +0,0 @@ -// Licensed under the Apache License, Version 2.0 (the "License"); you may not -// use this file except in compliance with the License. You may obtain a copy of -// the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -// License for the specific language governing permissions and limitations under -// the License. - -define([ - "app", - - "api", - - // Modules - "addons/logs/routes" -], - -function(app, FauxtonAPI, Log) { - Log.initialize = function() { - FauxtonAPI.addHeaderLink({title: "Log", href: "#_log", icon: "fonticon-log", className: 'logs'}); - }; - - return Log; -}); http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/35a839db/app/addons/logs/resources.js ---------------------------------------------------------------------- diff --git a/app/addons/logs/resources.js b/app/addons/logs/resources.js deleted file mode 100644 index cd0f54a..0000000 --- a/app/addons/logs/resources.js +++ /dev/null @@ -1,212 +0,0 @@ -// Licensed under the Apache License, Version 2.0 (the "License"); you may not -// use this file except in compliance with the License. You may obtain a copy of -// the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -// License for the specific language governing permissions and limitations under -// the License. - -define([ - "app", - "api", - "backbone", - "d3", - "addons/fauxton/components" -], - -function (app, FauxtonAPI, Backbone, d3, Components) { - - var Log = FauxtonAPI.addon(); - - Log.Model = Backbone.Model.extend({ - - initialize: function () { - this.dateObject = new Date(this.get('date')); - }, - - date: function () { - var formatter = d3.time.format("%b %e"); - - return formatter(this.dateObject); - }, - - time: function () { - var formatter = d3.time.format("%H:%M:%S"); - - return formatter(this.dateObject); - }, - - logLevel: function () { - return this.get('log_level').replace(/ /g,''); - }, - - pid: function () { - return _.escape(this.get('pid')); - }, - - args: function () { - return _.escape(this.get('args')); - } - - }); - - Log.Collection = Backbone.Collection.extend({ - model: Log.Model, - - initialize: function (options) { - this.params = {bytes: 5000}; - }, - - documentation: "log", - - url: function () { - var query = "?" + $.param(this.params); - return app.host + '/_log' + query; - }, - - // override fetch because backbone expects json and couchdb sends text/html for logs, - // I think its more elegant to set the dataType here than where ever fetch is called - fetch: function (options) { - options = options ? options : {}; - - return Backbone.Collection.prototype.fetch.call(this, _.extend(options, {dataType: "html"})); - }, - - sortLogsIntoDays: function () { - return _.reduce(this.toArray(), function (sortedCollection, log, key) { - var date = log.date(); - - if (!sortedCollection[date]) { - sortedCollection[date] = []; - } - - sortedCollection[date].push(log); - return sortedCollection; - }, {}); - }, - - parse: function (resp) { - resp = resp.replace(/\n\s/g, ''); - var lines = resp.split(/\n/); - return _.foldr(lines, function (acc, logLine) { - var match = logLine.match(/^\[(.*?)\]\s\[(.*?)\]\s\[(.*?)\]\s(.*)/); - - if (!match) { return acc;} - - acc.push({ - date: match[1], - log_level: match[2], - pid: match[3], - args: match[4].replace(/\s\s+/g, '') - }); - - return acc; - }, []); - } - }); - - Log.events = {}; - _.extend(Log.events, Backbone.Events); - - Log.Views.View = FauxtonAPI.View.extend({ - template: "addons/logs/templates/dashboard", - - initialize: function (options) { - this.refreshTime = options.refreshTime || 5000; - - Log.events.on("log:filter", this.filterLogs, this); - Log.events.on("log:remove", this.removeFilterLogs, this); - - this.filters = []; - - this.collection.on("add", function () { - this.render(); - }, this); - }, - - establish: function () { - return [this.collection.fetch()]; - }, - - serialize: function () { - var collection = new Log.Collection(this.createFilteredCollection()); - - return { - days: collection.sortLogsIntoDays() - }; - }, - - afterRender: function () { - this.startRefreshInterval(); - }, - - cleanup: function () { - this.stopRefreshInterval(); - }, - - filterLogs: function (filter) { - this.filters.push(filter); - this.render(); - }, - - createFilteredCollection: function () { - var that = this; - - return _.reduce(this.filters, function (logs, filter) { - - return _.filter(logs, function (log) { - var match = false; - - _.each(log, function (value) { - if (value.toString().match(new RegExp(filter))) { - match = true; - } - }); - return match; - }); - - - }, this.collection.toJSON(), this); - - }, - - removeFilterLogs: function (filter) { - this.filters.splice(this.filters.indexOf(filter), 1); - this.render(); - }, - - startRefreshInterval: function () { - var collection = this.collection; - - // Interval already set - if (this.intervalId) { return ; } - - this.intervalId = setInterval(function () { - collection.fetch(); - }, this.refreshTime); - - }, - - stopRefreshInterval: function () { - clearInterval(this.intervalId); - } - }); - - Log.Views.Sidebar = FauxtonAPI.View.extend({ - template: "addons/logs/templates/sidebar", - - initialize: function (options) { - this.setView(".js-filter", new Components.FilterView({ - eventListener: Log.events, - eventNamespace: "log" - })); - } - }); - - return Log; - -}); http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/35a839db/app/addons/logs/routes.js ---------------------------------------------------------------------- diff --git a/app/addons/logs/routes.js b/app/addons/logs/routes.js deleted file mode 100644 index ce6522b..0000000 --- a/app/addons/logs/routes.js +++ /dev/null @@ -1,58 +0,0 @@ -// Licensed under the Apache License, Version 2.0 (the "License"); you may not -// use this file except in compliance with the License. You may obtain a copy of -// the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -// License for the specific language governing permissions and limitations under -// the License. - -define([ - "app", - - "api", - - // Modules - "addons/logs/resources" -], - -function(app, FauxtonAPI, Log) { - - var LogRouteObject = FauxtonAPI.RouteObject.extend({ - layout: "with_sidebar", - - crumbs: [ - {"name": "Logs", "link": "_log"} - ], - - routes: { - "_log": "showLog" - }, - - selectedHeader: "Log", - - roles: ["_admin"], - - apiUrl: function() { - return [this.logs.url(), this.logs.documentation]; - }, - - initialize: function () { - this.logs = new Log.Collection(); - this.setView("#sidebar-content", new Log.Views.Sidebar({})); - }, - - showLog: function () { - this.setView("#dashboard-content", new Log.Views.View({collection: this.logs})); - } - }); - - Log.RouteObjects = [LogRouteObject]; - - return Log; - -}); - http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/35a839db/app/addons/logs/templates/dashboard.html ---------------------------------------------------------------------- diff --git a/app/addons/logs/templates/dashboard.html b/app/addons/logs/templates/dashboard.html deleted file mode 100644 index 855da37..0000000 --- a/app/addons/logs/templates/dashboard.html +++ /dev/null @@ -1,50 +0,0 @@ - - -
-

CouchDB Logs

- - - - - - - - - - - - <% _.forEach(days, function (logs, date) { %> - - <% _.forEach(logs, function (log) { %> - - - - - - - <% }); %> - <% }); %> - -
DateLog ValuePidUrl
<%= date %>
- <%= log.time() %> - - <%= log.logLevel() %> - - <%= log.pid() %> - - - <%= log.args() %> -
-
http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/35a839db/app/addons/logs/templates/sidebar.html ---------------------------------------------------------------------- diff --git a/app/addons/logs/templates/sidebar.html b/app/addons/logs/templates/sidebar.html deleted file mode 100644 index b9116f1..0000000 --- a/app/addons/logs/templates/sidebar.html +++ /dev/null @@ -1,18 +0,0 @@ - - -
-
Log Filter
-
-
http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/35a839db/app/addons/logs/tests/baseSpec.js ---------------------------------------------------------------------- diff --git a/app/addons/logs/tests/baseSpec.js b/app/addons/logs/tests/baseSpec.js deleted file mode 100644 index 621cc9b..0000000 --- a/app/addons/logs/tests/baseSpec.js +++ /dev/null @@ -1,38 +0,0 @@ -// Licensed under the Apache License, Version 2.0 (the "License"); you may not -// use this file except in compliance with the License. You may obtain a copy of -// the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -// License for the specific language governing permissions and limitations under -// the License. -define([ - 'addons/logs/base', - 'chai' -], function (Log, chai) { - var expect = chai.expect; - - describe('Logs Addon', function(){ - - describe('Log Model', function () { - var log; - - beforeEach(function () { - log = new Log.Model({ - log_level: 'DEBUG', - pid: '1234', - args: 'testing 123', - date: (new Date()).toString() - }); - }); - - it('should have a log level', function () { - expect(log.logLevel()).to.equal('DEBUG'); - }); - - }); - }); -}); http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/35a839db/app/addons/logs/tests/resourcesSpec.js ---------------------------------------------------------------------- diff --git a/app/addons/logs/tests/resourcesSpec.js b/app/addons/logs/tests/resourcesSpec.js deleted file mode 100644 index 916dc91..0000000 --- a/app/addons/logs/tests/resourcesSpec.js +++ /dev/null @@ -1,117 +0,0 @@ -// Licensed under the Apache License, Version 2.0 (the 'License'); you may not -// use this file except in compliance with the License. You may obtain a copy of -// the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an 'AS IS' BASIS, WITHOUT -// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -// License for the specific language governing permissions and limitations under -// the License. - -define([ - 'addons/logs/resources', - 'testUtils' -], function (Log, testUtils) { - var assert = testUtils.assert, - ViewSandbox = testUtils.ViewSandbox; - - describe('Logs Resources', function () { - - describe('Log Parser', function () { - it('parses GET messages', function () { - var parsedLog, - collection, - log = '[Sat, 12 Apr 2014 13:02:58 GMT] [info] [<0.3097.2>] 127.0.0.1 - - GET /_session 200\n' + - '[Sat, 12 Apr 2014 13:02:58 GMT] [info] [<0.3098.2>] 127.0.0.1 - - GET /_session 200\n' + - '[Sat, 12 Apr 2014 13:02:58 GMT] [info] [<0.3099.2>] 127.0.0.1 - - GET / 200\n'; - - collection = new Log.Collection(); - parsedLog = collection.parse(log); - assert.equal(parsedLog[0].date, 'Sat, 12 Apr 2014 13:02:58 GMT'); - assert.equal(parsedLog[0].args, '127.0.0.1 - - GET / 200'); - }); - - it('parses GET messages with erlang errors', function () { - var parsedLog, - collection, - log = '[Sat, 12 Apr 2014 13:14:15 GMT] [info] [<0.9491.2>] Retrying GET to http://176.9.4.195/registry/genstatic?revs=true&open_revs=%5B%224-a9be203658a59fd2116ae9acbd10f0de%22%5D&latest=true in 1.0 seconds due to error {error,\n' + - ' {error,\n' + - ' connection_closing}}\n' + - '[Sat, 12 Apr 2014 13:14:15 GMT] [error] [<0.9499.2>] Replicator, request GET to "http://176.9.4.195/registry/google-openid?revs=true&open_revs=%5B%2219-380884ba97e3d6fc48c8c7db3dc0e91b%22%5D&latest=true" failed due to error {error,connection_closing}\n' + - '[Sat, 12 Apr 2014 13:14:15 GMT] [info] [<0.9497.2>] Retrying GET to http://176.9.4.195/registry/google-openid?revs=true&open_revs=%5B%2219-380884ba97e3d6fc48c8c7db3dc0e91b%22%5D&latest=true in 1.0 seconds due to error {error,\n' + - ' {error,\n' + - ' connection_closing}}\n' + - '[Sat, 12 Apr 2014 13:14:15 GMT] [error] [<0.9507.2>] Replicator, request GET to "http://176.9.4.195/registry/google-openid?revs=true&open_revs=%5B%224-c8ba4809e2cacc1635f8887ec0d8d49a%22%5D&latest=true" failed due to error {error,connection_closing}\n' + - '[Sat, 12 Apr 2014 13:14:15 GMT] [info] [<0.9505.2>] Retrying GET to http://176.9.4.195/registry/google-openid?revs=true&open_revs=%5B%224-c8ba4809e2cacc1635f8887ec0d8d49a%22%5D&latest=true in 1.0 seconds due to error {error,\n' + - ' {error,\n' + - ' connection_closing}}\n'; - - collection = new Log.Collection(); - parsedLog = collection.parse(log); - assert.equal(parsedLog[1].date, 'Sat, 12 Apr 2014 13:14:15 GMT'); - assert.equal(parsedLog[1].args, 'Replicator, request GET to "http://176.9.4.195/registry/google-openid?revs=true&open_revs=%5B%224-c8ba4809e2cacc1635f8887ec0d8d49a%22%5D&latest=true" failed due to error {error,connection_closing}'); - assert.equal(parsedLog[2].args, 'Retrying GET to http://176.9.4.195/registry/google-openid?revs=true&open_revs=%5B%2219-380884ba97e3d6fc48c8c7db3dc0e91b%22%5D&latest=true in 1.0 seconds due to error {error,{error,connection_closing}}'); - }); - }); - - describe('uses a heading for each date (COUCHDB-2136)', function () { - var collection, - view; - - beforeEach(function () { - collection = new Log.Collection([ - new Log.Model({ - date: new Date('Fri Apr 19 2014 12:06:01 GMT+0200 (CEST)'), - log_level: 'info', - pid: 1337, - args: 'ente ente' - }), - new Log.Model({ - date: new Date('Fri Apr 18 2014 12:06:01 GMT+0200 (CEST)'), - log_level: 'info', - pid: 1337, - args: 'ente ente' - }), - new Log.Model({ - date: new Date('Thu Apr 17 2014 12:06:01 GMT+0200 (CEST)'), - log_level: 'info', - pid: 1337, - args: 'ente ente' - }), - new Log.Model({ - date: new Date('Thu Apr 16 2014 12:06:01 GMT+0200 (CEST)'), - log_level: 'info', - pid: 1337, - args: 'ente ente' - }) - ]); - - }); - - it('sorts the data into an object', function () { - var sortedCollection = collection.sortLogsIntoDays(); - - assert.property(sortedCollection, 'Apr 18'); - assert.property(sortedCollection, 'Apr 17'); - }); - - it('creates headers with dates', function () { - var titles = [], - viewSandbox, - view; - - view = new Log.Views.View({collection: collection}); - viewSandbox = new ViewSandbox(); - viewSandbox.renderView(view); - - view.$('td[colspan="4"]').each(function (i, elem) { - titles.push($(elem).text()); - }); - assert.include(titles, 'Apr 18'); - assert.include(titles, 'Apr 17'); - }); - }); - }); -}); http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/35a839db/assets/less/fauxton.less ---------------------------------------------------------------------- diff --git a/assets/less/fauxton.less b/assets/less/fauxton.less index 177cadc..fc92909 100644 --- a/assets/less/fauxton.less +++ b/assets/less/fauxton.less @@ -859,12 +859,6 @@ form.view-query-update, form.view-query-save { max-width: 100%; } -/*logs*/ -#log-sidebar{ - padding: 20px; -} - - /*documents and databases */ .view.show{ color: @fontGrey; http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/35a839db/settings.json.default ---------------------------------------------------------------------- diff --git a/settings.json.default b/settings.json.default index eedf2f1..bc5a617 100644 --- a/settings.json.default +++ b/settings.json.default @@ -6,7 +6,6 @@ { "name": "pouchdb" }, { "name": "activetasks" }, { "name": "config" }, - { "name": "logs" }, { "name": "stats" }, { "name": "replication" }, { "name": "plugins" }, http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/35a839db/settings.json.dev ---------------------------------------------------------------------- diff --git a/settings.json.dev b/settings.json.dev index d354c29..62cd1e7 100644 --- a/settings.json.dev +++ b/settings.json.dev @@ -6,7 +6,6 @@ { "name": "pouchdb" }, { "name": "activetasks" }, { "name": "config" }, - { "name": "logs" }, { "name": "stats" }, { "name": "replication" }, { "name": "plugins" },