{"id":19197011,"url":"https://github.com/jitesoft/php-loggers","last_synced_at":"2025-10-05T02:26:50.062Z","repository":{"id":47718143,"uuid":"115151245","full_name":"jitesoft/php-loggers","owner":"jitesoft","description":"A collection of loggers implementing the PSR-3 logger interface.","archived":false,"fork":false,"pushed_at":"2022-10-23T19:54:41.000Z","size":211,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-04T10:08:54.235Z","etag":null,"topics":["hacktoberfest","logging","php","psr","psr-3"],"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/jitesoft.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":"2017-12-22T21:26:38.000Z","updated_at":"2023-01-28T14:25:59.000Z","dependencies_parsed_at":"2023-01-20T08:48:50.752Z","dependency_job_id":null,"html_url":"https://github.com/jitesoft/php-loggers","commit_stats":null,"previous_names":[],"tags_count":25,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jitesoft%2Fphp-loggers","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jitesoft%2Fphp-loggers/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jitesoft%2Fphp-loggers/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jitesoft%2Fphp-loggers/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jitesoft","download_url":"https://codeload.github.com/jitesoft/php-loggers/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240271531,"owners_count":19774859,"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":["hacktoberfest","logging","php","psr","psr-3"],"created_at":"2024-11-09T12:15:15.620Z","updated_at":"2025-10-05T02:26:45.028Z","avatar_url":"https://github.com/jitesoft.png","language":"PHP","funding_links":["https://opencollective.com/jitesoft-open-source"],"categories":[],"sub_categories":[],"readme":"# Loggers\n\n[![pipeline status](https://gitlab.com/jitesoft/open-source/php/loggers/badges/master/pipeline.svg)](https://gitlab.com/jitesoft/open-source/php/loggers/commits/master)\n[![coverage report](https://gitlab.com/jitesoft/open-source/php/loggers/badges/master/coverage.svg)](https://gitlab.com/jitesoft/open-source/php/loggers/commits/master)\n[![Back project](https://img.shields.io/badge/Open%20Collective-Tip%20the%20devs!-blue.svg)](https://opencollective.com/jitesoft-open-source)\n[![PHP-Version](https://img.shields.io/packagist/php-v/jitesoft/loggers.svg)](https://packagist.org/packages/jitesoft/loggers) \n\n[![Packagist PHP Version (2.x.x/dev-php-7)](https://img.shields.io/badge/v2.x-%3E%3D7.4.2%7C%3E%3D8-blue)](https://packagist.org/packages/jitesoft/loggers)\n[![Packagist PHP Version (3.x.x/dev-php-8)](https://img.shields.io/badge/v3.x-%3E%3D8-blue)](https://packagist.org/packages/jitesoft/loggers)\n[![Packagist PHP Version (4.x.x/dev-master)](https://img.shields.io/badge/v4.x-%3E%3D8.1-blue)](https://packagist.org/packages/jitesoft/loggers)\n\n\nThis repository contains a set of loggers implementing the PSR-3 logger interface.  \nPull-requests and feature requests welcome.\n\n## Php7 and Php8\n\nv2.x tags requires php 7+  \nv3.x tags requires php 8+  \nv4.x tags requires php 8.1+  \n\nOnly latest (currently php8.1+) is maintained.\n\n## Implemented loggers\n\nAll loggers are able to set which logging levels they should actually log on via the `setLogLevel` method.\n\n### `StdLogger`\n\nLogs output to stdout and stderr.  \nIt's possible to change the format of the output and of the timestamp via the `setFormat` and `setTimeFormat` methods\nin the instance class.\n\n### `FileLogger`\n\nThe FileLogger is probably the most useful logger. All it does is to print the output to a file of choice \n(defaults to `/tmp/log.txt`).  \nIt's (as with `StdLogger`) possible to change the format of the output and of the timestamp.\n\n### `JsonLogger`\n\nThe JsonLogger is a StdLogger which logs a json object instead of the standard\nformatted string.  \nThe json object looks as the following:\n\n```json\n{ \"severity\": \"error\", \"message\": \"Formatted message.\", \"context\": { }, \"time\": \"1977-04-22T06:00:00Z\", \"ts\": 230533200 }\n```\n\n### `JsonFileLogger`\n\nThe JsonFileLogger is a FileLogger which logs a json object instead of\nthe standard formatted string.\nEach log entry will be a new object, the following format is used:\n\n```json\n{ \"severity\": \"error\", \"message\": \"Formatted message.\", \"context\": { }, \"time\": \"1977-04-22T06:00:00Z\", \"ts\": 230533200 }\n```\n\n### `PDOLogger`\n\nLogs output to a PDO connection of choice. The table that it expects to add data to should look like the following:\n\n```text\nlevel   - varchar(255)\nmessage - text\ntime    - datetime\n```\n\nConvenience method:\n\n```sql\nCREATE TABLE IF NOT EXISTS log_messages (`level` int, `message` TEXT, `time` TIME )\n``` \n\n### `SysLogLogger`\n\nThe SysLogLogger sends your logs to a local syslog server.  \nAs of right now, it is not able to use a remote server, but should later on...\n\nInternally it uses the php `syslog` and `openlog` methods. Check the constructor docs for default values.\n\n### `MultiLogger`\n\nThe MultiLogger was created to make it possible to log with multiple loggers in a single logger.  \nThis due to the fact that you often wish to bind the logger to the LoggerInterface for dependency injection\nsomething that will not allow you to bind multiple loggers!  \nYou can add and remove loggers via `addLogger(LoggerInterface $logger, string $name = null)` \nand `removeLogger(LoggerInterface|string $logger)`\n\n### `CallbackLogger`\n\nThe CallbackLogger is basically just a callback which gets invoked on log. \nThe callback is passed the following arguments:\n\n```text\nstring: loglevel\nstring: message (message with context placeholders replaced)\nstring: text (message without context placeholders replaced)\narray:  context\n```\n\n### `CompactJsonLogger`\n\nLogger using (Compact Log Event Format JSON)[https://clef-json.org/] output to streams.\n\nOutput format:\n\n```json\n{\"@t\":\"DateTime as ISO8601 String\",\"@l\":\"(int)level\",\"@m\":\"Formatted message\",\"@mt\":\"Message template\",\"@r\": {\"context-key\": \"context-value\"}}\n```\n\n### `CompactJsonFileLogger`\n\nLogger using (Compact Log Event Format JSON)[https://clef-json.org/] output to file.\n\n```json\n{\"@t\":\"DateTime as ISO8601 String\",\"@l\":\"(int)level\",\"@m\":\"Formatted message\",\"@mt\":\"Message template\",\"@r\": {\"context-key\": \"context-value\"}}\n```\n\n----\n\nLicense\n\n```text\nMIT License\n\nCopyright (c) 2020 Jitesoft\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjitesoft%2Fphp-loggers","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjitesoft%2Fphp-loggers","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjitesoft%2Fphp-loggers/lists"}