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

Vladimir Gorej commented on LOG4PHP-110:
----------------------------------------

Hi,

I am reacting to Ivan Habunek comment. I am commiter to log4mongo-php 
repository.

I made a new branch with suggested corrections. The branch can be seen here: 
https://github.com/log4mongo/log4mongo-php/tree/refactor/

* It does not follow naming conventions - it should be called LoggerLayoutBson.
  > Remaned to LoggerLayoutBson

* The name suggests it formats data in BSON format, but it doesnt; it returns 
ArrayObject objects. Maybe it should be called LogerLayoutArray or similar. 
BTW, why use ArrayObject instead of the regular PHP array?
  > The layout now returns string in bson format. I decided to use ArrayObject, 
becase I saw a ticket in this jira, that everything should be reviewed and SPL 
should be used where appropriate. My second argument is that this ArrayObject 
is passed though many function and method calls. ArrayObject garantes that only 
object handle is passed and no array copies are created while passing it as 
argument to function of method. If i would to use array, every method/function 
call would create copy of passed array.

LoggerLayoutBson is now fully compatible with your other layouts. 
LoggerAppenderMongoDBLayout should not be dropped, because it allows api user 
to creates a custom layout and modify mongo record as he wishes. For example: 

 class LoggerMongoDbBsonIpLayout extends LoggerMongoDbBsonLayout {
   
      public function format(LoggerLoggingEvent $event) {
          $document       = parent::format($event);
          $document['ip'] = $event->getMDC('ip');
          
          return json_encode($document);
      }
  }

* Third, the tests do not follow conventions (one test class pre tested class). 
This refers to LoggerAppenderMongoDBLayoutTest.php which should be integrated 
into the appender test class or the layout test class.
 > This last part i did not get. Please explain further what exactly you want 
 > me to do with the tests.

Thanks for feedback 

> mongo database appender for log4php
> -----------------------------------
>
>                 Key: LOG4PHP-110
>                 URL: https://issues.apache.org/jira/browse/LOG4PHP-110
>             Project: Log4php
>          Issue Type: New Feature
>          Components: Code, Documentation, Tests
>    Affects Versions: 2.0
>         Environment: PHP
>            Reporter: Vladimir Gorej
>            Assignee: Christian Grobmeier
>             Fix For: 2.1
>
>         Attachments: src.tgz, throwable.path
>
>
> mongo database appender for log4php with unit test coverage

-- 
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to