{"id":20418250,"url":"https://github.com/askonomm/loggr","last_synced_at":"2025-09-24T06:31:52.713Z","repository":{"id":262151930,"uuid":"886367934","full_name":"askonomm/loggr","owner":"askonomm","description":"An extendable logging utility class with built-in support for various logging formats.","archived":false,"fork":false,"pushed_at":"2024-11-17T14:15:59.000Z","size":84,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-11T19:52:20.767Z","etag":null,"topics":["logging","php"],"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/askonomm.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","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}},"created_at":"2024-11-10T20:27:01.000Z","updated_at":"2024-11-17T12:47:21.000Z","dependencies_parsed_at":"2024-11-10T21:38:09.380Z","dependency_job_id":null,"html_url":"https://github.com/askonomm/loggr","commit_stats":null,"previous_names":["askonomm/loggr"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/askonomm%2Floggr","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/askonomm%2Floggr/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/askonomm%2Floggr/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/askonomm%2Floggr/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/askonomm","download_url":"https://codeload.github.com/askonomm/loggr/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":234048075,"owners_count":18771472,"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":["logging","php"],"created_at":"2024-11-15T06:30:46.452Z","updated_at":"2025-09-24T06:31:47.418Z","avatar_url":"https://github.com/askonomm.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Loggr\n\n[![codecov](https://codecov.io/gh/askonomm/loggr/graph/badge.svg?token=lQDNAnAWKn)](https://codecov.io/gh/askonomm/loggr)\n\nAn extendable logging utility class brought to you by the frustration of every logging class always having its own unique format, \nwhich makes using log viewing tools difficult. Instead of having its own yet-another-format that no tool supports, Loggr attempts to match \nmany already existing formats, allowing you to use whichever you prefer most.\n\n## Requirements\n\n- PHP 8.3+\n\n## Installation\n\n```bash\ncomposer require asko/loggr\n```\n\n## Usage\n\nLoggr is very simple to use, and looks like this:\n\n```php\n$loggr = new Loggr(new FileSystemDriver('path-to-logs'));\n$loggr-\u003einfo('message', ['some-data' =\u003e 'goes-here']);\n```\n\nAll you have to do is instantiate Loggr with the appropriate driver for your use case and then simply \nlog away with any data you want to give it. As per the PSR-3 standard, you can also interpolate context values \ninto the message placeholder, like so:\n\n```php\n$loggr = new Loggr(new FileSystemDriver('path-to-logs'));\n$loggr-\u003einfo('Hello {who}', ['who' =\u003e 'World']);\n```\n\nWhich would then output `Hello World` as the message.\n\n### Methods\n\nLoggr supports all of these logging methods:\n\n- `emergency(string $message, mixed $context = null)`\n- `alert(string $message, mixed $context = null)`\n- `critical(string $message, mixed $context = null)`\n- `error(string $message, mixed $context = null)`\n- `warning(string $message, mixed $context = null)`\n- `notice(string $message, mixed $context = null)`\n- `info(string $message, mixed $context = null)`\n- `debug(string $message, mixed $context = null)`\n- `log(mixed $level, string $message, mixed $context = null)`\n\n### Setting log format\n\nYou can change the logging format by setting the `format` variable in Loggr constructor to a value of `Format` enum, like so:\n\n```php\n$loggr = new Loggr(new FileSystemDriver('path-to-logs'), format: Format::JSON);\n```\n\nOr, if that gets a bit too long for just one line, you can also do:\n\n```php\n$loggr = new Loggr(new FileSystemDriver('path-to-logs'));\n$loggr-\u003eformat = Format::JSON;\n```\n\nLoggr supports the following log formats:\n\n- `Format::JSON` - Entries are JSON objects.\n- `Format::Laravel` - Entries correspond to the Laravel log format.\n- `Format::Symfony` - Entries correspond to the Symfony log format.\n- `Format::IntelliJ` - Entries correspond to the IntelliJ log format.\n\n## Extending\n\nYou can extend Loggr with your own custom drivers. A driver is a class that implements the `Driver` interface and is \nresponsible for making sure that the serialized log entry would end up in the right place.\n\n### Built-in drivers\n\n- [FileSystemDriver](https://github.com/askonomm/loggr/blob/main/src/Drivers/FileSystemDriver.php)\n- [OutputDriver](https://github.com/askonomm/loggr/blob/main/src/Drivers/OutputDriver.php)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faskonomm%2Floggr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faskonomm%2Floggr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faskonomm%2Floggr/lists"}