{"id":27180413,"url":"https://github.com/yardinternet/logger","last_synced_at":"2026-03-05T00:36:35.604Z","repository":{"id":286977531,"uuid":"914387132","full_name":"yardinternet/logger","owner":"yardinternet","description":"Replaceable PSR-3 logger","archived":false,"fork":false,"pushed_at":"2026-02-24T00:34:29.000Z","size":54,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":4,"default_branch":"main","last_synced_at":"2026-02-24T07:36:35.589Z","etag":null,"topics":[],"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/yardinternet.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":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-01-09T13:53:15.000Z","updated_at":"2026-02-24T00:34:32.000Z","dependencies_parsed_at":null,"dependency_job_id":"3f38f355-aed2-4f9d-b41a-3bbc24002722","html_url":"https://github.com/yardinternet/logger","commit_stats":null,"previous_names":["yardinternet/logger"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/yardinternet/logger","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yardinternet%2Flogger","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yardinternet%2Flogger/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yardinternet%2Flogger/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yardinternet%2Flogger/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yardinternet","download_url":"https://codeload.github.com/yardinternet/logger/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yardinternet%2Flogger/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30102482,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-04T23:59:36.199Z","status":"ssl_error","status_checked_at":"2026-03-04T23:56:48.556Z","response_time":59,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: 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":"2025-04-09T14:35:46.381Z","updated_at":"2026-03-05T00:36:35.586Z","avatar_url":"https://github.com/yardinternet.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Replaceable PSR-3 Logger\n\n[![Code Style](https://github.com/yardinternet/logger/actions/workflows/format-php.yml/badge.svg?no-cache)](https://github.com/yardinternet/logger/actions/workflows/format-php.yml)\n[![PHPStan](https://github.com/yardinternet/logger/actions/workflows/phpstan.yml/badge.svg?no-cache)](https://github.com/yardinternet/logger/actions/workflows/phpstan.yml)\n[![Tests](https://github.com/yardinternet/logger/actions/workflows/run-tests.yml/badge.svg?no-cache)](https://github.com/yardinternet/logger/actions/workflows/run-tests.yml)\n[![Code Coverage Badge](https://github.com/yardinternet/logger/blob/badges/coverage.svg)](https://github.com/yardinternet/logger/actions/workflows/badges.yml)\n[![Lines of Code Badge](https://github.com/yardinternet/logger/blob/badges/lines-of-code.svg)](https://github.com/yardinternet/logger/actions/workflows/badges.yml)\n\nComposer package that provides a very basic PSR-3 logger. This logger is just a wrapper around PHP function `error_log()`.\nAs such it does not have any requirements other than `psr/log`. It is meant to be used in PHP environments that might not\nfeature a DI container, like WordPress.\n\nThe provided logger is actually meant as a temporary stub. The most prominent feature of this package is that the logger\ncan be replaced by any another PSR-3 logger. This allows projects to push a single logger to its dependencies and achieve\nconsistent log handling.\n\n## Installation\n\nTo install this package using Composer, follow these steps:\n\n1. Add the following to the `repositories` section of your `composer.json`:\n\n    ```json\n    {\n      \"type\": \"vcs\",\n      \"url\": \"git@github.com:yardinternet/logger.git\"\n    }\n    ```\n\n2. Install this package with Composer:\n\n    ```sh\n    composer require yard/logger\n    ```\n\n## Usage\n\nSimply use the static `Log` facade:\n\n```php\nLog::error('Whoops.');\n```\n\nOr get the PSR-3 logger instance from it:\n\n```php\n$logger = Log::getLogger();\n```\n\nProjects that wish to replace the logger instance can use the static `setLogger()` method, like this:\n\n```php\nLog::setLogger(app()-\u003emake('log'));\n```\n\n### WordPress\n\nWhen using the logger in WordPress themes, the above replacement method is not recommended, due to the practise of vendor prefixing. The recommended method to replace the logger from a WordPress theme is to:\n\n1. Use `do_action()` in WordPress themes to pass the desired logger to any plugins\n2. Use `add_action()` in WordPress plugins to receive a logger instance and set it.\n\nThe `Log` class provides the `WP_ACTION_SET_LOGGER` constant, which contains the name of the WordPress action that should be used. Hooking into the action should look like:\n\n```php\nadd_action(Yard\\Logging\\Log::WP_ACTION_SET_LOGGER, Log::setLogger(...));\n```\n\nAn [Acorn](https://roots.io/acorn/) based WordPress theme for example could push its Laravel logger like this:\n\n```php\ndo_action(Yard\\Logging\\Log::WP_ACTION_SET_LOGGER, app()-\u003emake('log'));\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyardinternet%2Flogger","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyardinternet%2Flogger","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyardinternet%2Flogger/lists"}