{"id":35472601,"url":"https://github.com/thomasisberg/php-elog","last_synced_at":"2026-01-03T11:04:06.347Z","repository":{"id":57070117,"uuid":"450498726","full_name":"thomasisberg/php-elog","owner":"thomasisberg","description":"Simple PHP solution for enhanced logging.","archived":false,"fork":false,"pushed_at":"2022-01-27T09:32:37.000Z","size":46,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-11-01T04:06:43.266Z","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/thomasisberg.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":"2022-01-21T13:18:16.000Z","updated_at":"2022-01-27T09:31:37.000Z","dependencies_parsed_at":"2022-08-24T10:40:50.088Z","dependency_job_id":null,"html_url":"https://github.com/thomasisberg/php-elog","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/thomasisberg/php-elog","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thomasisberg%2Fphp-elog","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thomasisberg%2Fphp-elog/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thomasisberg%2Fphp-elog/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thomasisberg%2Fphp-elog/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thomasisberg","download_url":"https://codeload.github.com/thomasisberg/php-elog/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thomasisberg%2Fphp-elog/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28188361,"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","status":"online","status_checked_at":"2026-01-03T02:00:06.471Z","response_time":75,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":"2026-01-03T11:03:21.355Z","updated_at":"2026-01-03T11:04:06.338Z","avatar_url":"https://github.com/thomasisberg.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# php-elog\n\nSimple PHP solution for enhanced logging.\n\n## Installation\n\n```bash\ncomposer require tintonic/php-elog\n```\n\n## Usage\n\n### Simple usage – create instance and log via helpers\n\nThis example creates an `Elog` instance that will log to a file named `elog.log` in the same directory as executing script (`__DIR__`). The helper function `elog()` logs to the instance of `Elog` that was first created.\n\n```php\ncreate_elog();\n\n/*\nLogs to the first instance that was created.\nLogs to \"__DIR__/elog.log\"\n*/\nelog(\"I am elog.log\");\n```\n\n### Logging different data types\n\n* `null` is presented as `[null]`\n* `empty string` is presented as `[empty string]`\n* `true` is presented as `[true]`\n* `false` is presented as `[false]`\n* `object` and `array` is described using `print_r()`\n\n```php\ncreate_elog();\n\nelog(null);  // [null]\n\nelog('');    // [empty string]\n\nelog(true);  // [true]\n\nelog(false); // [false]\n\n\nelog((object) [\n    'id' =\u003e 123,\n    'foo' =\u003e 'bar'\n]);\n\n/*\nstdClass Object\n(\n    [id] =\u003e 123\n    [foo] =\u003e bar\n)\n*/\n\n\nelog([\n    'id' =\u003e 123,\n    'foo' =\u003e 'bar'\n]);\n\n/*\nArray\n(\n    [id] =\u003e 123\n    [foo] =\u003e bar\n)\n*/\n```\n\n\n### Include label and / or data type\n\n```php\nelog(123, 'Current value', true);\n\n/*\n--- Current value {integer} ---\n123\n*/\n```\n\n\n### Named instances\n\nThis example creates two named `Elog` instances – one that logs to `_DIR__/first.log` and another that logs to `/path/to/log/second_log_file` (without file extension).\n\n```php\ncreate_elog(__DIR__, 'first');\ncreate_elog('/path/to/log', 'second', 'second_log_file', null);\n\n// Log to named instances using elogn().\nelogn('first', \"I am first.log\");         //  ———\u003e  __DIR__/first.log\nelogn('second', \"I am second_log_file\");  //  ———\u003e  /path/to/log/second_log_file\n```\n\n### Using the Elog class\n\nOf course you may use the `Elog` class directly.\n\nThis example also demonstrates how you can configure a default value for `$include_type` to always include the data type in the output.\n\n```php\nuse Tintonic/PhpElog/Elog;\n\n/*\nCreate an instance named \"notes\" that logs to \"/path/to/log/elog.txt\" with data type by default.\n*/\n$logger = new Elog('/path/to/log', 'notes', 'elog', 'txt');\n$logger-\u003eset_default_include_type(true);\n\n/*\nLog to named instance somewhere else in the application.\n*/\nElog::logn('notes', 123);\n\n/*\n{integer} \n123\n*/\n\n\nElog::logn('notes' 'bar', 'Foo?');\n\n/*\n--- Foo? {string} ---\nbar\n*/\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthomasisberg%2Fphp-elog","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthomasisberg%2Fphp-elog","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthomasisberg%2Fphp-elog/lists"}