{"id":19143798,"url":"https://github.com/teodoroleckie/log","last_synced_at":"2026-06-11T05:30:19.732Z","repository":{"id":57070527,"uuid":"358834640","full_name":"teodoroleckie/log","owner":"teodoroleckie","description":"⚡ PSR-3 Logger. Fully decoupled PSR-3 library for logs","archived":false,"fork":false,"pushed_at":"2021-05-11T07:23:26.000Z","size":76,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-03T15:45:43.362Z","etag":null,"topics":["log","loggerinterface","php","php-log","php-psr-3","php8","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/teodoroleckie.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":["teodoroleckie"],"custom":["https://www.paypal.com/donate?business=ZHYA2MTGA4884\u0026currency_code=USD"]}},"created_at":"2021-04-17T09:16:44.000Z","updated_at":"2021-05-13T05:38:06.000Z","dependencies_parsed_at":"2022-08-24T14:54:22.872Z","dependency_job_id":null,"html_url":"https://github.com/teodoroleckie/log","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/teodoroleckie%2Flog","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/teodoroleckie%2Flog/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/teodoroleckie%2Flog/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/teodoroleckie%2Flog/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/teodoroleckie","download_url":"https://codeload.github.com/teodoroleckie/log/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240224795,"owners_count":19767808,"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":["log","loggerinterface","php","php-log","php-psr-3","php8","psr-3"],"created_at":"2024-11-09T07:32:51.575Z","updated_at":"2026-06-11T05:30:17.677Z","avatar_url":"https://github.com/teodoroleckie.png","language":"PHP","funding_links":["https://github.com/sponsors/teodoroleckie","https://www.paypal.com/donate?business=ZHYA2MTGA4884\u0026currency_code=USD"],"categories":[],"sub_categories":[],"readme":"### Logger:\n\n[![Latest Version on Packagist](https://img.shields.io/packagist/v/tleckie/log.svg?style=flat-square)](https://packagist.org/packages/tleckie/log)\n[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/teodoroleckie/log/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/teodoroleckie/log/?branch=master)\n[![Build Status](https://scrutinizer-ci.com/g/teodoroleckie/log/badges/build.png?b=master)](https://scrutinizer-ci.com/g/teodoroleckie/log/build-status/master)\n[![Total Downloads](https://img.shields.io/packagist/dt/tleckie/log.svg?style=flat-square)](https://packagist.org/packages/tleckie/log)\n[![Code Intelligence Status](https://scrutinizer-ci.com/g/teodoroleckie/log/badges/code-intelligence.svg?b=master)](https://scrutinizer-ci.com/code-intelligence)\n\n\nYou can install the package via composer:\n\n```bash\ncomposer require tleckie/log\n```\n\n\n```php\n\nrequire_once \"vendor/autoload.php\";\n\nuse Tleckie\\Log\\Handler\\StreamHandler;\nuse Tleckie\\Log\\Handler\\FileHandler;\nuse Tleckie\\Log\\Level;\nuse Tleckie\\Log\\Log;\n\n$handlers = [\n    new StreamHandler(Level::DEBUG),\n    new FileHandler(Level::DEBUG, '/tmp/error.log')\n];\n\n$log = new Log($handlers);\n\nclass DummyToString {\n    public function __toString(): string\n    {\n        return 'My string';\n    }\n}\n\nclass DummySerialize implements \\JsonSerializable {\n    public function jsonSerialize()\n    {\n        return [\n            'value1',\n            'value2'\n        ];\n    }\n}\n\n$log-\u003ealert(new Exception('Test alert message'),[1,2]);\n$log-\u003ecritical('Test critical message: {A} =\u003e {B}', ['A' =\u003e '(A value)', 'B' =\u003e '(B value)']);\n$log-\u003einfo('Test info message');\n$log-\u003eerror(new Exception('Test error message'));\n$log-\u003eemergency('Test emergency message');\n$log-\u003eemergency(['{A}' =\u003e 155555, '{B}' =\u003e 99999], ['A' =\u003e '(A value)', 'B' =\u003e '(B value)']);\n$log-\u003eemergency(['A' =\u003e 155555, 'B' =\u003e 99999]);\n$log-\u003eemergency(new class(){});\n$log-\u003eemergency(new DummyToString());\n$log-\u003eemergency(new DummySerialized());\n```\n\n#### Output:\n\n```txt\n[2021-04-20T13:24:35+02:00] channel.ALERT \"Test alert message\" {\"class\":\"Exception\",\"message\":\"Test alert message\",\"code\":0,\"file\":\"/log/index.php:34\"} [1,2]\n[2021-04-20T13:24:35+02:00] channel.CRITICAL \"Test critical message: (A value) =\u003e (B value)\" {} {\"A\":\"(A value)\",\"B\":\"(B value)\"}\n[2021-04-20T13:24:35+02:00] channel.INFO \"Test info message\" {} []\n[2021-04-20T13:24:35+02:00] channel.ERROR \"Test error message\" {\"class\":\"Exception\",\"message\":\"Test error message\",\"code\":0,\"file\":\"/log/index.php:37\"} []\n[2021-04-20T13:24:35+02:00] channel.EMERGENCY \"Test emergency message\" {} []\n[2021-04-20T13:24:35+02:00] channel.EMERGENCY \"{\\\"(A value)\\\":155555,\\\"(B value)\\\":99999}\" {} {\"A\":\"(A value)\",\"B\":\"(B value)\"}\n[2021-04-20T13:24:35+02:00] channel.EMERGENCY \"{\\\"A\\\":155555,\\\"B\\\":99999}\" {} []\n[2021-04-20T13:24:35+02:00] channel.EMERGENCY \"class@anonymous\\u0000/log/index.php:41$2\" {} []\n[2021-04-20T13:24:35+02:00] channel.EMERGENCY \"My string\" {} []\n[2021-04-20T13:24:35+02:00] channel.EMERGENCY \"[\\\"value1\\\",\\\"value2\\\"]\" {} []\n```\n\n#### Default line format:\n\n```txt\n[%date%] %channel%.%level% %message% %context%\n```\n\n```php\n\u003c?php\n\nrequire_once \"vendor/autoload.php\";\n\nuse Tleckie\\Log\\Handler\\StreamHandler;\nuse Tleckie\\Log\\Level;\nuse Tleckie\\Log\\Log;\n\n$handlers = [new StreamHandler(Level::DEBUG)];\n\n// change line format\n$lineFormat = \"[%date%] [%channel%] =\u003e (%level%) %message% %context%\";\n$log = new Log($handlers, 'channelName', $lineFormat);\n```\n\n#### Output:\n\n```txt\n[2021-04-20T13:33:03+02:00] [channel] =\u003e (ALERT) \"Test alert message\" {\"class\":\"Exception\",\"message\":\"Test alert message\",\"code\":0,\"file\":\"/log/index.php:34\"} [1,2]\n[2021-04-20T13:33:03+02:00] [channel] =\u003e (CRITICAL) \"Test critical message: (A value) =\u003e (B value)\" {} {\"A\":\"(A value)\",\"B\":\"(B value)\"}\n[2021-04-20T13:33:03+02:00] [channel] =\u003e (INFO) \"Test info message\" {} []\n[2021-04-20T13:33:03+02:00] [channel] =\u003e (ERROR) \"Test error message\" {\"class\":\"Exception\",\"message\":\"Test error message\",\"code\":0,\"file\":\"/log/index.php:37\"} []\n[2021-04-20T13:33:03+02:00] [channel] =\u003e (EMERGENCY) \"Test emergency message\" {} []\n[2021-04-20T13:33:03+02:00] [channel] =\u003e (EMERGENCY) \"{\\\"(A value)\\\":155555,\\\"(B value)\\\":99999}\" {} {\"A\":\"(A value)\",\"B\":\"(B value)\"}\n[2021-04-20T13:33:03+02:00] [channel] =\u003e (EMERGENCY) \"{\\\"A\\\":155555,\\\"B\\\":99999}\" {} []\n[2021-04-20T13:33:03+02:00] [channel] =\u003e (EMERGENCY) \"class@anonymous\\u0000/log/index.php:41$2\" {} []\n[2021-04-20T13:33:03+02:00] [channel] =\u003e (EMERGENCY) \"My string\" {} []\n[2021-04-20T13:33:03+02:00] [channel] =\u003e (EMERGENCY) \"[\\\"value1\\\",\\\"value2\\\"]\" {} []\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fteodoroleckie%2Flog","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fteodoroleckie%2Flog","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fteodoroleckie%2Flog/lists"}