{"id":16184342,"url":"https://github.com/mattmezza/php-logger","last_synced_at":"2025-04-07T12:46:21.605Z","repository":{"id":57016546,"uuid":"159816742","full_name":"mattmezza/php-logger","owner":"mattmezza","description":"A tiny PHP logger","archived":false,"fork":false,"pushed_at":"2019-02-11T20:58:15.000Z","size":14,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-13T15:36:29.660Z","etag":null,"topics":["debug","error","info","kiss","log","logging","stdout","syslog"],"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/mattmezza.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"license.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-11-30T11:53:13.000Z","updated_at":"2023-05-22T13:55:59.000Z","dependencies_parsed_at":"2022-08-22T09:30:29.921Z","dependency_job_id":null,"html_url":"https://github.com/mattmezza/php-logger","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mattmezza%2Fphp-logger","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mattmezza%2Fphp-logger/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mattmezza%2Fphp-logger/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mattmezza%2Fphp-logger/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mattmezza","download_url":"https://codeload.github.com/mattmezza/php-logger/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247656030,"owners_count":20974283,"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":["debug","error","info","kiss","log","logging","stdout","syslog"],"created_at":"2024-10-10T07:09:54.303Z","updated_at":"2025-04-07T12:46:21.579Z","avatar_url":"https://github.com/mattmezza.png","language":"PHP","readme":"php-logger\n=====\n\n[![Travis (.org)](https://img.shields.io/travis/mattmezza/php-logger.svg)](https://github.com/mattmezza/php-logger)\n\nThis package is a small utility for logging purposes. It allows you to quickly set up a logging system.\n\n## Usage\n\nThe main component to use is `LevelLogger`. Just create a new instance and start logging.\n\n```php\n$log = new LevelLogger();\n\n$log-\u003einfo('DONE.');\n$log-\u003edebug('I\\'m here.');\n$log-\u003eerror($exception-\u003egetMessage());\n```\n\nThere are `3` levels namely `info|debug|error` that come handy when switching environment `development|staging|production`.\n\nThe package comes with `3` logging strategies namely:\n\n- `STDOUT` (default): it just `echo` the message (together with a timestamp and the log level)\n- `SYSLOG`: calls the `syslog(...)` function and logs the message (using the syslog format) to the system log\n- `FILE`: appends the log message (together with the timestamp and log level) to a file that you specify\n\n#### How do you specify the parameters?\n\nThe package reads from `ENV` variables. The following variables are used:\n\n- `LOG_LEVEL`: can be either `INFO|DEBUG|ERROR` and defaults to `ERROR` to be the least verbose. When the log level is `ERROR` all the `info` and `debug` messages will not be logged. When the log level is set to `DEBUG`, all the `info` messages will not be logged. When set to `INFO` instead, all of the messages will be logged;\n- `LOG_STRATEGY`: can be either `STDOUT|SYSLOG|FILE` and defaults to `SYSLOG`. It sets the strategy. When the `FILE` strategy is chosen, please specify the file path by using the next described variable;\n- `LOG_FILE_PATH`: must be a writable file path. It defaults to `/var/log/logger.log`;\n \n## Development\n\nYou can add new loggers by implementing the `Logger` interface.\n\n## Further development\n\n- [ ] Would be nice to add a file rotate feature when logging to file.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmattmezza%2Fphp-logger","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmattmezza%2Fphp-logger","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmattmezza%2Fphp-logger/lists"}