{"id":16718474,"url":"https://github.com/neeckeloo/monolog-module","last_synced_at":"2025-10-23T20:50:05.309Z","repository":{"id":23271385,"uuid":"26629954","full_name":"neeckeloo/monolog-module","owner":"neeckeloo","description":"Monolog integration into Laminas","archived":false,"fork":false,"pushed_at":"2023-01-25T10:59:04.000Z","size":68,"stargazers_count":8,"open_issues_count":5,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-18T05:11:45.913Z","etag":null,"topics":["lamina","logging","monolog"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/neeckeloo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-11-14T08:46:03.000Z","updated_at":"2022-11-26T22:18:30.000Z","dependencies_parsed_at":"2023-02-14T07:01:01.964Z","dependency_job_id":null,"html_url":"https://github.com/neeckeloo/monolog-module","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neeckeloo%2Fmonolog-module","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neeckeloo%2Fmonolog-module/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neeckeloo%2Fmonolog-module/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neeckeloo%2Fmonolog-module/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/neeckeloo","download_url":"https://codeload.github.com/neeckeloo/monolog-module/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244874093,"owners_count":20524572,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["lamina","logging","monolog"],"created_at":"2024-10-12T21:37:17.810Z","updated_at":"2025-10-23T20:50:05.242Z","avatar_url":"https://github.com/neeckeloo.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"Monolog module for Laminas\n=================================\n\nModule to integrate Monolog with Laminas projects.\n\n[![Build Status](https://img.shields.io/travis/neeckeloo/monolog-module.svg?style=flat-square)](http://travis-ci.org/neeckeloo/monolog-module)\n[![Latest Stable Version](http://img.shields.io/packagist/v/neeckeloo/monolog-module.svg?style=flat-square)](https://packagist.org/packages/neeckeloo/monolog-module)\n[![Total Downloads](http://img.shields.io/packagist/dt/neeckeloo/monolog-module.svg?style=flat-square)](https://packagist.org/packages/neeckeloo/monolog-module)\n[![Coverage Status](http://img.shields.io/coveralls/neeckeloo/MonologModule.svg?style=flat-square)](https://coveralls.io/r/neeckeloo/MonologModule)\n\n## Requirements\n\n* PHP ^8.0\n* [monolog/monolog ^2.0 || ^3.0](http://www.github.com/Seldaek/monolog)\n* [laminas/laminas-servicemanager ^3.3.2](https://github.com/laminas/laminas-servicemanager)\n\n## Installation\n\nMonologModule must be installed through Composer. For Composer documentation, please refer to [getcomposer.org](http://getcomposer.org).\n\nYou can install the module from command line:\n\n```sh\n$ composer require neeckeloo/monolog-module\n```\n\nEnable the module by adding `MonologModule` key in your `application.config.php` file.\n\n## Usage\n\n### Configuring a logger\n\nThis is the configuration of a logger that can be retrieved with key ```Log\\App``` in the service manager. A channel name ```default``` is also defined to identify to which part of the application a record is related.\n\n```php\nreturn [\n    'monolog' =\u003e [\n        'loggers' =\u003e [\n            'Log\\App' =\u003e [\n                'name' =\u003e 'default',\n            ],\n        ],\n    ],\n];\n```\n\n### Adding a handler\n\nThe logger itself does not know how to handle a record. It delegates it to some handlers. The code above registers two handlers in the stack to allow handling records in two different ways.\n\n```php\nreturn [\n    'monolog' =\u003e [\n        'loggers' =\u003e [\n            'Log\\App' =\u003e [\n                'name' =\u003e 'default',\n                'handlers' =\u003e [\n                    'stream' =\u003e [\n                        'name' =\u003e StreamHandler::class,\n                        'options' =\u003e [\n                            'path'   =\u003e 'data/log/application.log',\n                            'level'  =\u003e Logger::DEBUG,\n                        ],\n                    ],\n                    'fire_php' =\u003e [\n                        'name' =\u003e FirePHPHandler::class,\n                    ],\n                ],\n            ],\n        ],\n    ],\n];\n```\n\n### Using processors\n\nIf you want to add extra information (tags, user IP, ...) to the records before they are handled, you should add some processors. The code above adds two processors that add an unique identifier and the current request URI, request method and client IP to a log record.\n\n```php\nreturn [\n    'monolog' =\u003e [\n        'loggers' =\u003e [\n            'Log\\App' =\u003e [\n                'name' =\u003e 'default',\n                'handlers' =\u003e [\n                    'default' =\u003e [\n                        'name' =\u003e StreamHandler::class,\n                        'options' =\u003e [\n                            'path'   =\u003e 'data/log/application.log',\n                            'level'  =\u003e Logger::DEBUG,\n                        ],\n                    ],\n                ],\n                'processors' =\u003e [\n                    UidProcessor::class,\n                    WebProcessor::class,\n                ],\n            ],\n        ],\n    ],\n];\n```\n\nYou can also add processors to a specific handler.\n\n```php\nreturn [\n    'monolog' =\u003e [\n        'loggers' =\u003e [\n            'Log\\App' =\u003e [\n                'name' =\u003e 'default',\n                'handlers' =\u003e [\n                    'default' =\u003e [\n                        'name' =\u003e StreamHandler::class,\n                        'options' =\u003e [\n                            'path'   =\u003e 'data/log/application.log',\n                            'level'  =\u003e Logger::DEBUG,\n                        ],\n                        'processors' =\u003e [\n                            UidProcessor::class,\n                            WebProcessor::class,\n                        ],\n                    ],\n                ],\n            ],\n        ],\n    ],\n];\n```\n\n### Retrieving a logger\n\nOnce the configuration is complete, you can retrieve an instance of the logger as below:\n\n```php\n$logger = $serviceManager-\u003eget('Log\\App');\n$logger-\u003edebug('debug message');\n```\n\n## Testing\n\n``` bash\n$ vendor/bin/phpunit\n```\n\n## Credits\n\n- [Nicolas Eeckeloo](https://github.com/neeckeloo)\n- [All Contributors](https://github.com/RiskioFr/monolog-module/contributors)\n\n## License\n\nThe MIT License (MIT). Please see [License File](https://github.com/RiskioFr/monolog-module/blob/master/LICENSE) for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fneeckeloo%2Fmonolog-module","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fneeckeloo%2Fmonolog-module","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fneeckeloo%2Fmonolog-module/lists"}