{"id":17725483,"url":"https://github.com/webarchitect609/log-tools","last_synced_at":"2026-02-24T09:35:07.940Z","repository":{"id":62547323,"uuid":"170695828","full_name":"webarchitect609/log-tools","owner":"webarchitect609","description":"PSR-3 compatible logger tools","archived":false,"fork":false,"pushed_at":"2024-06-28T15:26:14.000Z","size":23,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-11-27T16:46:18.002Z","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":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/webarchitect609.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-02-14T13:30:03.000Z","updated_at":"2025-02-12T11:00:11.000Z","dependencies_parsed_at":"2024-10-25T20:09:26.500Z","dependency_job_id":"08c00521-f795-40f3-986f-79882a8ddebd","html_url":"https://github.com/webarchitect609/log-tools","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/webarchitect609/log-tools","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webarchitect609%2Flog-tools","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webarchitect609%2Flog-tools/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webarchitect609%2Flog-tools/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webarchitect609%2Flog-tools/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/webarchitect609","download_url":"https://codeload.github.com/webarchitect609/log-tools/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webarchitect609%2Flog-tools/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29777924,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-24T04:54:30.205Z","status":"ssl_error","status_checked_at":"2026-02-24T04:53:58.628Z","response_time":75,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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-10-25T16:04:38.971Z","updated_at":"2026-02-24T09:35:06.295Z","avatar_url":"https://github.com/webarchitect609.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"Log Tools\n=========\n[![Travis Build Status](https://travis-ci.org/webarchitect609/log-tools.svg?branch=master)](https://travis-ci.org/webarchitect609/log-tools)\n[![Latest version](https://img.shields.io/github/v/tag/webarchitect609/log-tools?sort=semver)](https://github.com/webarchitect609/log-tools/releases)\n[![Downloads](https://img.shields.io/packagist/dt/webarchitect609/log-tools)](https://packagist.org/packages/webarchitect609/log-tools)\n[![PHP version](https://img.shields.io/packagist/php-v/webarchitect609/log-tools)](https://www.php.net/supported-versions.php)\n[![License](https://img.shields.io/github/license/webarchitect609/log-tools)](LICENSE.md)\n[![More stuff from me](https://img.shields.io/badge/packagist-webarchitect609-blueviolet)](https://packagist.org/packages/webarchitect609/)\n\nPSR-3 compatible logger tools\n\nFeatures\n--------\n\n- Log any exception properly: with the stack trace, with all previous exceptions, etc\n- Daily logger: setup directory with log files with 'Y_m_d' timestamp as a filename\n\nInstallation\n------------\n`composer require webarchitect609/log-tools`\n\nUsage\n-----\n\n### LogExceptionTrait\n\nUse `\\WebArch\\LogTools\\Traits\\LogExceptionTrait` instead of `\\Psr\\Log\\LoggerAwareTrait` in the class you want to be\nable to log exceptions in more convenient way. Do not forget to implement `\\Psr\\Log\\LoggerAwareInterface`.\n\nWhen an exception or error occurs feel free to use `logException()` method to log it nice and easy. Exception chaining\nis enabled by default, but in case you don't need it you can use `setChaining(false)` method.\n\n```php\nuse Monolog\\Handler\\StreamHandler;\nuse Monolog\\Logger;\nuse Psr\\Log\\LoggerAwareInterface;\nuse Psr\\Log\\LogLevel;\nuse WebArch\\LogTools\\Traits\\LogExceptionTrait;\n\nclass FooService implements LoggerAwareInterface\n{\n    use LogExceptionTrait;\n\n    public function __construct()\n    {\n        $this-\u003esetLogger(\n            new Logger(\n                'FooLogger',\n                [new StreamHandler(sys_get_temp_dir() . '/foo-service.log')]\n            )        \n        );\n    }\n\n    public function bar()\n    {\n        try {\n\n            throw new LogicException('Exception occurs in ' . __METHOD__);\n\n        } catch (Throwable $exception) {\n\n            /**\n             * Exception will be logged with it's type, message, code, file, line and stack trace.\n             */\n            $this-\u003elogException($exception, LogLevel::CRITICAL, ['var1' =\u003e 'ABC']);\n        }\n    }\n\n}\n```\n\n### MonologLoggerFactory\n\nUse `\\WebArch\\LogTools\\Factory\\MonologLoggerFactory` to simplify creating logs on daily basis.\n\n```php\nuse WebArch\\LogTools\\Enum\\SystemStream;\nuse WebArch\\LogTools\\Factory\\MonologLoggerFactory;\n\n$debug = false;\n$loggerFactory = new MonologLoggerFactory('/tmp/log/www', $debug);\n$logger = $loggerFactory-\u003ecreateFileLogger('bar', 'foo/baz.log', SystemStream::STDERR);\n\n/**\n * Creates `/tmp/log/www/foo/baz.log`\n * and outputs `[2019-02-15 12:42:59] bar.INFO: Hello, world! [] []` there\n * and to the STDERR. \n */\n$logger-\u003einfo(\n    'Hello, world!'\n);\n```\n\nKnown Issues\n------------\nNone so far.\n\nLicence \u0026 Author Information\n----------------------------\n[BSD-3-Clause](LICENSE.md)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwebarchitect609%2Flog-tools","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwebarchitect609%2Flog-tools","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwebarchitect609%2Flog-tools/lists"}