{"id":22397173,"url":"https://github.com/putyourlightson/craft-log-to-file","last_synced_at":"2025-10-10T10:44:54.709Z","repository":{"id":54840919,"uuid":"178185946","full_name":"putyourlightson/craft-log-to-file","owner":"putyourlightson","description":"Logs messages to a specific log file.","archived":false,"fork":false,"pushed_at":"2022-08-09T07:44:07.000Z","size":29,"stargazers_count":29,"open_issues_count":0,"forks_count":5,"subscribers_count":3,"default_branch":"v1","last_synced_at":"2025-09-21T02:57:33.725Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/putyourlightson.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2019-03-28T11:04:02.000Z","updated_at":"2024-08-23T20:33:35.000Z","dependencies_parsed_at":"2022-08-14T04:30:22.761Z","dependency_job_id":null,"html_url":"https://github.com/putyourlightson/craft-log-to-file","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/putyourlightson/craft-log-to-file","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/putyourlightson%2Fcraft-log-to-file","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/putyourlightson%2Fcraft-log-to-file/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/putyourlightson%2Fcraft-log-to-file/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/putyourlightson%2Fcraft-log-to-file/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/putyourlightson","download_url":"https://codeload.github.com/putyourlightson/craft-log-to-file/tar.gz/refs/heads/v1","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/putyourlightson%2Fcraft-log-to-file/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279003547,"owners_count":26083595,"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":"2025-10-10T02:00:06.843Z","response_time":62,"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":"2024-12-05T06:11:09.150Z","updated_at":"2025-10-10T10:44:54.675Z","avatar_url":"https://github.com/putyourlightson.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Log To File Helper for Craft CMS 3\n\nThe Log To File helper provides a simple way for logging messages to a specific file. It is intended to be used a helper class for modules and plugins in [Craft CMS](https://craftcms.com/).\n\n## Craft 4 Support\n\nThis package will _not_ be updated for use with Craft 4. Instead, we recommend you use a custom Monolog log target to achieve a similar (better) result, as explained in https://putyourlightson.com/articles/adding-logging-to-craft-plugins-with-monolog\n\n## Requirements\n\nThis component requires Craft CMS 3.0.0 or later.\n\n## Usage\n\nInstall it manually using composer:\n\n```shell\ncomposer require putyourlightson/craft-log-to-file\n```\n\nOr add it as a dependency to your plugin:\n\n```\n\"require\": {\n    \"putyourlightson/craft-log-to-file\": \"^1.0.0\"\n},\n```\nThen you can write messages to a log file as follows.\n\n```php\nuse putyourlightson\\logtofile\\LogToFile;\n\n$message = 'The message to log.';\n\n// Log as info\nLogToFile::info($message, 'my-plugin-handle');\n\n// Log as error\nLogToFile::error($message, 'my-plugin-handle');\n\n// Log as Yii message level\nLogToFile::log($message, 'my-plugin-handle', 'error');\n\n// Log as custom category\nLogToFile::log($message, 'my-plugin-handle', 'custom-category');\n```\n\nThe result is a concise log file that contains messages relevant to your module/plugin only.\n\n### File: `my-plugin-handle.log`\n\n```\n2019-04-24 09:47:14 [info] Notification email sent to user #34.\n2019-04-24 17:53:45 [info] Notification email sent to user #56.\n2019-04-24 19:45:52 [error] Template `notification` not found.\n2019-04-24 19:56:13 [debug] Template `notification` could not be rendered.\n```\n\n## License\n\nThis software is licensed for free under the MIT License.\n\n---\n\nCreated by [PutYourLightsOn](https://putyourlightson.com/).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fputyourlightson%2Fcraft-log-to-file","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fputyourlightson%2Fcraft-log-to-file","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fputyourlightson%2Fcraft-log-to-file/lists"}