{"id":21681757,"url":"https://github.com/cbschuld/logentries","last_synced_at":"2025-04-12T06:41:38.404Z","repository":{"id":62500355,"uuid":"41600234","full_name":"cbschuld/logentries","owner":"cbschuld","description":"LogEntries for PHP - an easy-to-use PHP PSR-3 compliant logging class used to log information to the LogEntries SaaS application.","archived":false,"fork":false,"pushed_at":"2020-06-24T16:14:34.000Z","size":21,"stargazers_count":3,"open_issues_count":1,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-26T02:03:42.468Z","etag":null,"topics":["logentries","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/cbschuld.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":"2015-08-29T16:47:05.000Z","updated_at":"2023-03-09T01:32:34.000Z","dependencies_parsed_at":"2022-11-02T09:46:34.062Z","dependency_job_id":null,"html_url":"https://github.com/cbschuld/logentries","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cbschuld%2Flogentries","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cbschuld%2Flogentries/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cbschuld%2Flogentries/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cbschuld%2Flogentries/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cbschuld","download_url":"https://codeload.github.com/cbschuld/logentries/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248530610,"owners_count":21119591,"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":["logentries","php"],"created_at":"2024-11-25T15:31:14.725Z","updated_at":"2025-04-12T06:41:38.374Z","avatar_url":"https://github.com/cbschuld.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# LogEntries\n[![Build Status](https://travis-ci.org/cbschuld/logentries.svg?branch=master)](https://travis-ci.org/cbschuld/logentries)\n\nA LogEntries specific logging class by [Chris Schuld](http://chrisschuld.com/) for logging information to [LogEntries](https://logentries.com)\n\n## About\n\nLogEntries is an easy-to-use PHP [PSR-3](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md)\ncompliant logging class used to log information to the [LogEntries](https://logentries.com) SaaS application.\n\n## Installation\n\n### Composer\n\nFrom the Command Line:\n\n```\ncomposer require cbschuld/LogEntries:1.*\n```\n\nIn your `composer.json`:\n\n``` json\n{\n    \"require\": {\n        \"cbschuld/LogEntries\": \"1.*\"\n    }\n}\n```\n\n## Basic Usage\n\n``` php\n\u003c?php\n\nuse cbschuld\\LogEntries;\n\nrequire \"vendor/autoload.php\";\n$token = \"2bfbea1e-10c3-4419-bdad-7e6435882e1f\"; // your LogEntries token (sample from docs)\n\n$log = LogEntries::getLogger($token,true,true); // create persistent SSL-based connection\n$log-\u003einfo(\"some information\");\n$log-\u003enotice(json_encode([\"status\"=\u003e\"ok\",\"message\"=\u003e\"send some json\"]));\n\n```\n\n## Advanced Usage\n\nYou can send all of the logging functions either a string (PSR-3), encoded JSON (PSR-3)\nor an array which will be encoded into JSON (not PSR-3 but available)\n\n``` php\n\u003c?php\n\nuse cbschuld\\LogEntries;\n\nrequire \"vendor/autoload.php\";\n$token = \"2bfbea1e-10c3-4419-bdad-7e6435882e1f\"; // your LogEntries token (sample from docs)\n$jsonInfo = [\"json\"=\u003etrue,\"example\"=\u003e\"yes\",\"works\"=\u003etrue];\n\n$log = LogEntries::getLogger($token,true,true); // create persistent SSL-based connection\n$log-\u003einfo([\"status\"=\u003e\"ok\",\"example\"=\u003e\"with json messages\"]);\n$log-\u003enotice($jsonInfo);\n\n```\n\nYou can also create a non-static instantiation for dependency injection or multiple log token usage\n\n``` php\n\u003c?php\n\nuse cbschuld\\LogEntries;\n\nrequire \"vendor/autoload.php\";\n$token = \"2bfbea1e-10c3-4419-bdad-7e6435882e1f\"; // your LogEntries token (sample from docs)\n$jsonInfo = [\"json\"=\u003etrue,\"example\"=\u003e\"yes\",\"works\"=\u003etrue];\n\n$log = new LogEntries($token,true,true); // create persistent SSL-based connection\n$log-\u003einfo([\"status\"=\u003e\"ok\",\"example\"=\u003e\"with json messages\"]);\n$log-\u003enotice($jsonInfo);\n\n$token2 = \"2bfbea1e-10c3-4419-bdad-7e6435882e1f\"; // your LogEntries token (sample from docs)\n$log2 = new LogEntries($token2,true,true); // create persistent SSL-based connection\n$log2-\u003einfo([\"status\"=\u003e\"ok\",\"example\"=\u003e\"with json messages\",\"from\"=\u003e\"log2\"]);\n$log2-\u003enotice($jsonInfo);\n\n```\n\n## Middleware (Writer)\n\nUsing a LogEntriesWriter you can append log writing middleware into the log.  The middleware is called before the log\nis written to LogEntries.  It allows for sensing for JSON or text.  This allows you to append data from your\narchitecture into your logs.\n\nHere is a sample usage:\n\n``` php\n\u003c?php\n\nuse cbschuld\\LogEntries;\nuse cbschuld\\LogEntriesWriter;\n\nclass WriterTest extends LogEntriesWriter {\n    // always add the hostname\n    public function log($message,$isJson=false) {\n        if($isJson) {\n            $json = json_decode($message,true);\n            $json[\"hostname\"] = gethostname();\n            $message = json_encode($json);\n        }\n        else {\n            $hostname = gethostname();\n            $message .= \" hostname={$hostname}\";\n        }\n        return $message;\n    }\n}\n\n$writer = new WriterTest();\n\n$json = array(\n    \"datetime\" =\u003e new \\DateTime(\"now\"),\n    \"status\" =\u003e \"ok\",\n);\n$log = new LogEntries(\"MYTOKEN\",true,true);\n$log-\u003eaddWriter($writer);\n$log-\u003einfo($json);\n\n```\n\n\n## PSR-3 Compliant\n\nLogEntries is PHP [PSR-3](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md)\ncompliant. This means it implements the `Psr\\Log\\LoggerInterface`.\n\n[See Here for the interface definition.](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md#3-psrlogloggerinterface)\n\n\n## License\n\nThe MIT License\n\nCopyright (c) 2015 Chris Schuld \u003cchris@chrisschuld.com\u003e\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcbschuld%2Flogentries","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcbschuld%2Flogentries","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcbschuld%2Flogentries/lists"}