[ 
https://issues.apache.org/jira/browse/COUCHDB-2136?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13975627#comment-13975627
 ] 

ASF GitHub Bot commented on COUCHDB-2136:
-----------------------------------------

Github user garrensmith commented on a diff in the pull request:

    https://github.com/apache/couchdb/pull/214#discussion_r11811097
  
    --- Diff: src/fauxton/app/addons/logs/resources.js ---
    @@ -110,7 +119,28 @@ function (app, FauxtonAPI, Backbone, d3) {
         },
     
         serialize: function () {
    -      return { logs: new Log.Collection(this.createFilteredCollection())};
    +      var collection = new Log.Collection(this.createFilteredCollection());
    +
    +      return {
    +        days: this.sortLogsIntoDays(collection)
    +      };
    +    },
    +
    +    sortLogsIntoDays: function (collection) {
    +      var sortedCollection = {},
    +          date = null;
    +
    +      collection.each(function (log) {
    --- End diff --
    
    You can use `_.reduce` instead of `.each` it will make it much neater and 
require less variables. We use _.reduce in a couple places, so you can grep for 
some examples.


> Group log messages by date
> --------------------------
>
>                 Key: COUCHDB-2136
>                 URL: https://issues.apache.org/jira/browse/COUCHDB-2136
>             Project: CouchDB
>          Issue Type: Improvement
>      Security Level: public(Regular issues) 
>          Components: Fauxton
>            Reporter: Alexander Shorin
>            Assignee: Robert Kowalski
>
> Another idea how to get more free space for log message is grouping by 
> datetime. You'll rarely notice changes in date part while be reading the 
> logs, so it is possible to extract this common part as group header like:
> {code}
> [2010-02-13]
> ==============================================================================
> [02:31:30] [<0.6327.1>] httpd 401 error response:
>  {"error":"unauthorized","reason":"Name or password is incorrect."}
> [02:31:29] [<0.6258.1>] 'GET' /_log {1,1} from "127.0.0.1"
> Headers: 
> [{'Accept',"text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"},
>           {'Accept-Encoding',"gzip, deflate"},
>           {'Accept-Language',"en-US,en;q=0.5"},
>           {'Connection',"keep-alive"},
>           {'Cookie',"AuthSession="},
>           {'Host',"localhost:5984"}]
> ------------------------------------------------------------------------------
> [02:31:29] [<0.6258.1>] 'GET' /_log {1,1} from "127.0.0.1"
> Headers: 
> [{'Accept',"text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"},
>           {'Accept-Encoding',"gzip, deflate"},
>           {'Accept-Language',"en-US,en;q=0.5"},
>           {'Connection',"keep-alive"},
>           {'Cookie',"AuthSession="},
>           {'Host',"localhost:5984"}]
> {code}
> More free space for log message!



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to