{"id":15873791,"url":"https://github.com/xy2z/aclog","last_synced_at":"2025-06-28T17:05:59.470Z","repository":{"id":62548401,"uuid":"439131405","full_name":"xy2z/AcLog","owner":"xy2z","description":"Simple and lightweight PHP Logger for actions and activity.","archived":false,"fork":false,"pushed_at":"2023-06-15T19:20:13.000Z","size":23,"stargazers_count":4,"open_issues_count":1,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-01T18:17:14.346Z","etag":null,"topics":["actions","actvity","lightweight","log","logger","logging","php","zero-dependency"],"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/xy2z.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":"2021-12-16T21:27:19.000Z","updated_at":"2025-02-19T22:24:13.000Z","dependencies_parsed_at":"2023-02-10T11:20:22.185Z","dependency_job_id":null,"html_url":"https://github.com/xy2z/AcLog","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/xy2z/AcLog","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xy2z%2FAcLog","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xy2z%2FAcLog/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xy2z%2FAcLog/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xy2z%2FAcLog/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xy2z","download_url":"https://codeload.github.com/xy2z/AcLog/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xy2z%2FAcLog/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262465740,"owners_count":23315637,"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":["actions","actvity","lightweight","log","logger","logging","php","zero-dependency"],"created_at":"2024-10-06T01:06:38.919Z","updated_at":"2025-06-28T17:05:59.423Z","avatar_url":"https://github.com/xy2z.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# AcLog\n\nAcLog is a simple, zero-dependency PHP package to log activity to files.\n\nAcLog can be used to easily log actions such as cronjobs, emails, user activity, details about errors, etc.\n\n_🧡 Sponsored by **[Datsi.app - Your personal database](https://datsi.app/)**._\n\n\n## Requirements\n- PHP 8.0+\n\n\n## Install\nAdd this to your existing project:\n\n```\ncomposer require xy2z/aclog\n```\n\n\n## Basic Usage\n```php\nuse xy2z\\AcLog\\AcLog;\n\n$aclog = new AcLog(__DIR__ . '/logs');\n$aclog-\u003elog($var); // can be any type: object, array, string, int, etc.\n$aclog-\u003elog($var, $foo, $bar, $etc); // as many arguments you want.\n```\n\n\n### Set Options\n```php\n$aclog = new AcLog(\n    log_dir: __DIR__ . '/logs',\n    log_date_format: false,\n    include_trace: false,\n    output_method: AcLog::VAR_DUMP,\n    line_breaks_between_header: 4,\n    // etc.\n);\n```\n\nFor more options see the constructor method of the [AcLog.php](https://github.com/xy2z/AcLog/blob/master/src/AcLog.php) file.\n\n\n### Static Class\nIt is also possible to use it as a static class, if you prefer.\n```php\nuse xy2z\\AcLog\\AcLogStatic;\n\nAcLogStatic::setup(__DIR__ . '/logs');\nAcLogStatic::log($var);\n```\n\nIf you want to set options in the static class, you need to set them as an array.\n```php\nAcLogStatic::setup([\n    'log_dir' =\u003e __DIR__ . '/logs',\n    'log_date_format' =\u003e false,\n    'include_trace' =\u003e false,\n    'output_method' =\u003e AcLog::VAR_DUMP,\n    'line_breaks_between_header' =\u003e 4,\n    // etc.\n]);\n```\n\nOther than that, it should behave exactly the same as the AcLog class, and all public methods and properties are also available.\n\n\n#### Static Alias\nIf you want a shorter name for the static class, you can alias it.\n```php\nuse xy2z\\AcLog\\AcLogStatic as acl;\n\nacl::setup(__DIR__ . '/logs');\nacl::log($var);\n```\n\n\n### Log Callbacks\nYou can add callbacks that will be appended to each `log()` call, examples for this can be user information, request headers, etc. You can add as many callbacks you want.\n\n```php\n$aclog = new AcLog($this-\u003elogdir);\n\n$aclog-\u003eadd_log_append_callback(function () {\n    return 'callback-1.';\n});\n\n$aclog-\u003eadd_log_append_callback(array('MyClass', 'myCallbackMethod'));\n```\n\n\n## Tips\n- Consider to zip (7zip is best) the log files after a few days - it will save ALOT of diskspace.\n\n---\n\n## Developing\n\nPull Requests are welcome, just make sure your code is tested, analysed and fixed - see below.\n\nRemember to make tests for both classes: `AcLog` and `AcLogStatic`.\n\n```\n# Fix Coding Standards (php-cs-fixer)\ncomposer fix\n\n# Analyse code (phpstan)\ncomposer analyse\n\n# Test code (phpunit)\ncomposer test\n```\n\n\n### Todo\n- badges\n- Later: Method for getting options values\n- examples dir?\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxy2z%2Faclog","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxy2z%2Faclog","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxy2z%2Faclog/lists"}