Skip to content
This repository has been archived by the owner on Feb 27, 2024. It is now read-only.

Log demo module #113

Merged
merged 21 commits into from
Feb 25, 2015
Merged

Log demo module #113

merged 21 commits into from
Feb 25, 2015

Conversation

samsonasik
Copy link
Member

Fixes #106

@samsonasik samsonasik added this to the 0.1.1 milestone Feb 16, 2015
@samsonasik
Copy link
Member Author

I'm trying to re-set formatters of the Logger but it seems it not changed on loop formatters, and when changin on loop by addWriter, it got hang. @acelaya do you have an idea to re-set writers's formatter/filter so it can switch? hint : SplPriorityQueue...

@acelaya
Copy link
Contributor

acelaya commented Feb 20, 2015

I've been taking a look at a project where I used a logger.
Have you tried by setting the priority as a config property at the same level of options and name? The Logger constructor seems to look there for it.
Instead of this

'writers' => [
    [
        'name' => 'stream',
        'options' => [
            'stream' => 'php://output',
            'filters' => [
                'priority' => [
                    'name' => 'priority',
                    'options' => [
                        'priority' => \Zend\Log\Logger::DEBUG,
                    ],
                ],
            ],
            'formatter' => [
                'name' => 'simple',
                'options' => [
                    'format' => '%timestamp% %priorityName% (%priority%): %message%'.PHP_EOL,
                ],
            ],
        ],
    ],
],

Try with this

'writers' => [
    [
        'name' => 'stream',
        'priority' => \Zend\Log\Logger::DEBUG,
        'options' => [
            'stream' => 'php://output',
            'formatter' => [
                'name' => 'simple',
                'options' => [
                    'format' => '%timestamp% %priorityName% (%priority%): %message%'.PHP_EOL,
                ],
            ],
        ],
    ],
],

@samsonasik
Copy link
Member Author

Ok, I will try if that possible be change-able on form posted change priority/formatter. Thank you.

@samsonasik
Copy link
Member Author

I'm thinking about not inject controller with Logger instance, but use 'log' config as controller property, and create new Logger on the fly when form submitted, so Logger instance can be created by :

$this->loggerConfig['writers'][0]['options']['formatter']['name'] = $data['logformat'];
$logger = new Logger($this->loggerConfig);

I will do it..

@samsonasik
Copy link
Member Author

it succeed, log generated :
log-generated
I will write test for it ;)

@samsonasik samsonasik changed the title [WIP] Log demo module Log demo module Feb 21, 2015
@samsonasik
Copy link
Member Author

it's done, ready for review ;)

@samsonasik
Copy link
Member Author

@acelaya any review for this ? merge-able ?

@acelaya
Copy link
Contributor

acelaya commented Feb 23, 2015

Sorry, I won't be able to test it until tomorrow evening, sorry. However
I'm sure it works fine ;)

Alejandro Celaya Alastrué
www.alejandrocelaya.com
El 23/2/2015 11:21, "Abdul Malik Ikhsan" notifications@github.com
escribió:

@acelaya https://github.com/acelaya any review for this ? merge-able ?


Reply to this email directly or view it on GitHub
#113 (comment).

@samsonasik
Copy link
Member Author

It's ok for tomorrow ;). to reproduce it, there is updated
./data/sql/learnzf2.sql for addition module.
Thank you.

Warm Regards,

Abdul Malik Ikhsan

2015-02-23 17:23 GMT+07:00 Alejandro Celaya notifications@github.com:

Sorry, I won't be able to test it until tomorrow evening, sorry. However
I'm sure it works fine ;)

Alejandro Celaya Alastrué
www.alejandrocelaya.com
El 23/2/2015 11:21, "Abdul Malik Ikhsan" notifications@github.com
escribió:

@acelaya https://github.com/acelaya any review for this ? merge-able ?


Reply to this email directly or view it on GitHub
#113 (comment).


Reply to this email directly or view it on GitHub
#113 (comment).

@acelaya
Copy link
Contributor

acelaya commented Feb 24, 2015

It properly works. It can be merged!

@samsonasik samsonasik merged commit 13a6ab8 into sitrunlab:master Feb 25, 2015
samsonasik added a commit that referenced this pull request Feb 25, 2015
Forward port #113
* add/learn-zf2-log: (22 commits)
  changelog 113
  add IndexControllerFactory test
  place init() test in testHasElement()
  add LogForm test
  more test
  style
  move controller test under test/PHPUnit/Controller folder
  PHP_EOL php 5.4 && 5.5
  fixes codeception test of logger page
  done, ready for review
  log generated
  use logconfig as controller property so logger need to be instantiate on the fly
  inject controller with logger and form
  cs
  prepare add form and factory
  adding Form
  cs
  short array syntax
  short array syntax
  basic structure of module
  ...
@samsonasik samsonasik deleted the add/learn-zf2-log branch February 25, 2015 00:33
@samsonasik
Copy link
Member Author

@acelaya merged. Thanks ;)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[new module] Log demo
2 participants