{"id":18890609,"url":"https://github.com/passchn/cakephp-logging","last_synced_at":"2026-03-01T11:31:01.767Z","repository":{"id":253652551,"uuid":"844128088","full_name":"passchn/cakephp-logging","owner":"passchn","description":"Logging Plugin for CakePHP","archived":false,"fork":false,"pushed_at":"2024-08-18T18:33:42.000Z","size":34,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-22T15:49:26.972Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/passchn.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-08-18T13:22:15.000Z","updated_at":"2024-08-18T18:33:45.000Z","dependencies_parsed_at":"2025-04-14T23:31:20.452Z","dependency_job_id":"a5f610d1-7214-4224-afc8-17dfb9817eee","html_url":"https://github.com/passchn/cakephp-logging","commit_stats":null,"previous_names":["passchn/cakephp-logging"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/passchn/cakephp-logging","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/passchn%2Fcakephp-logging","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/passchn%2Fcakephp-logging/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/passchn%2Fcakephp-logging/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/passchn%2Fcakephp-logging/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/passchn","download_url":"https://codeload.github.com/passchn/cakephp-logging/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/passchn%2Fcakephp-logging/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29968437,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-01T10:55:55.490Z","status":"ssl_error","status_checked_at":"2026-03-01T10:55:55.175Z","response_time":124,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":[],"created_at":"2024-11-08T07:56:33.022Z","updated_at":"2026-03-01T11:31:01.741Z","avatar_url":"https://github.com/passchn.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Logging plugin for CakePHP\n\n## Installation\n\nYou can install this plugin into your CakePHP application using [composer](https://getcomposer.org).\n\nThe recommended way to install composer packages is:\n\n```sh\ncomposer require passchn/cakephp-logging\n```\n\nLoad the plugin:\n\n```sh\nbin/cake plugin load Passchn/CakeLogging\n```\n\n## Usage\n\nThe plugin enables you to configure the Cake Log class to use implementations of the PSR-3 logger interface which are\navailable\nin your Applications container.\n\nIt comes with a MultiLogger where you can define multiple implementations as fallbacks.\n\n## Configuration\n\nIn your `config/app.php` you can configure the logger like this:\n\n```php\n\nreturn [\n    'Log' =\u003e [\n        'debug' =\u003e [\n            'className' =\u003e LoggerFacade::class, // use the facade to configure the actual logger\n            LoggerFacade::CONFIG_KEY_UNDERLYING_LOGGER =\u003e MyLoggerImplementation::class, // a LoggerInterface implementation\n        ],\n    ],\n];\n```\n\nNote that `MyLoggerImplementation` must be available in your container.\n\n### MultiLogger usage\n\nYou can also use the MultiLogger to define multiple fallbacks:\n\n```php\nreturn [\n    \n    // default config for the multi logger\n    MultiLoggerConfig::class =\u003e [\n        MultiLoggerConfig::CONFIG_KEY_LOGGERS =\u003e [\n            SentryLogger::class,\n            FileLog::class,\n        ],\n    ],\n    \n    'Log' =\u003e [\n        'debug' =\u003e [\n            'className' =\u003e LoggerFacade::class,\n            LoggerFacade::CONFIG_KEY_UNDERLYING_LOGGER =\u003e MultiLogger::class,\n            MultiLoggerConfig::class =\u003e [\n                // multi logger config can be overridden here\n                MultiLoggerConfig::CONFIG_KEY_LOGGERS =\u003e [\n                    MyLoggerImplementation::class,\n                    AnotherLoggerImplementation::class,\n                    FileLog::class, // the default file logger as fallback\n                ],\n            ],\n            'path' =\u003e LOGS,\n            'file' =\u003e 'debug',\n            'url' =\u003e env('LOG_DEBUG_URL', null),\n            'scopes' =\u003e null,\n            'levels' =\u003e ['notice', 'info', 'debug'],\n        ],\n        \n        'error' =\u003e [\n            // ...\n        ],\n        \n        'emergency' =\u003e [\n            'className' =\u003e FileLog::class,\n            'className' =\u003e LoggerFacade::class,\n            LoggerFacade::CONFIG_KEY_UNDERLYING_LOGGER =\u003e MultiLogger::class,\n            MultiLoggerConfig::CONFIG_KEY_LOGGERS =\u003e [\n                SmsEmergencyLogger::class,\n                AlexaTextToSpeechAlarmWithWaterSprinklerLogger::class,\n            ],\n        ],\n    ],\n];\n```\n\nIf you use the default FileLogger, leave the config keys as they are as they will be used for the FileLog configuration.\n\nEvery logger used by the multi logger must be an implementation of the LoggerInterface which is available in your\ncontainer.\n\n### Configuring custom loggers\n\nIf you want to configure a custom logger, you can do so by implementing the `LoggerInterface` and adding it to your\ncontainer.\n\n```php\n\nuse Psr\\Log\\LoggerInterface;\n\nclass MyLoggerImplementation extends \\Psr\\Log\\AbstractLogger implements LoggerInterface\n{\n    public function __construct(\n        private readonly SomeDependency $dependency,\n    ) {\n        // ...\n    }\n\n    public function log($level, $message, array $context = [])\n    {\n        // your implementation\n    }\n}\n```\n\nThen, you can add it to your container.\n\nIn your Application.php:\n\n```php\n\npublic function services(ContainerInterface $container): void\n{\n    $container-\u003eadd(\n        MyLoggerImplementation::class, \n        fn () =\u003e new MyLoggerImplementation(\n            $container-\u003eget(SomeDependency::class),\n        ),\n    );\n}\n```\n\nThen, you can just use the implementation by adding the class name in your app.php configuration for the respective\nlogging scope:\n\n```php\nMultiLoggerConfig::CONFIG_KEY_LOGGERS =\u003e [\n    MyLoggerImplementation::class,\n    ...\n],\n```\n\nLearn more about Dependency Injection in\nthe [CakePHP Book](https://book.cakephp.org/5/en/development/dependency-injection.html).\n\n## Collaboration\n\nIf you have any ideas or encounter a bug, feel free to open an issue or a pull request.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpasschn%2Fcakephp-logging","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpasschn%2Fcakephp-logging","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpasschn%2Fcakephp-logging/lists"}