{"id":20963518,"url":"https://github.com/ialopezg/logger","last_synced_at":"2025-08-11T00:17:54.523Z","repository":{"id":56988032,"uuid":"297189299","full_name":"ialopezg/logger","owner":"ialopezg","description":"Logger Service for PHP","archived":false,"fork":false,"pushed_at":"2020-09-21T05:13:14.000Z","size":11,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-22T01:46:15.692Z","etag":null,"topics":["log","log-service","logger","logger-service","logging","logging-library","logging-service"],"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/ialopezg.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":"2020-09-21T00:28:54.000Z","updated_at":"2021-07-24T18:24:59.000Z","dependencies_parsed_at":"2022-08-21T12:50:28.118Z","dependency_job_id":null,"html_url":"https://github.com/ialopezg/logger","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/ialopezg/logger","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ialopezg%2Flogger","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ialopezg%2Flogger/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ialopezg%2Flogger/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ialopezg%2Flogger/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ialopezg","download_url":"https://codeload.github.com/ialopezg/logger/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ialopezg%2Flogger/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269810248,"owners_count":24478728,"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-08-10T02:00:08.965Z","response_time":71,"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":["log","log-service","logger","logger-service","logging","logging-library","logging-service"],"created_at":"2024-11-19T02:46:17.563Z","updated_at":"2025-08-11T00:17:54.471Z","avatar_url":"https://github.com/ialopezg.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Logger Service\n[![Total Downloads](https://img.shields.io/packagist/dt/ialopezg/logger.svg?style=flat-square)](https://packagist.org/packages/ialopezg/logger)\n[![License](https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square)](LICENSE.txt)\n\nLogger Service for PHP. Easily and customizable logger service. Allow to you write log files, in custom paths or directories, file extension, date format, message indentation and several levels.\n\n**Table of Contents**\n\n- [Requirements](#requirements)\n- [Installation](#installation)\n- [Usage](#basic-usage)\n    - [Options](#options)\n    - [Methods details](#method-details)\n- [License](#license)\n\n## Requirements\n\n* PHP 5.6+\n\n## Installation\n\nInstall latest version via composer:\n\n```shell script\ncomposer require ialopezg/logger\n```\n\n## Usage instructions\n\n### Basic usage\n\nFirst, create a new \"Logger\" instance. Logger aims to make configuring the library as easy as possible.\n\n```php\n$logger = new \\ialopezg\\Services\\Logger([\n    'log_path' =\u003e 'logs'\n]);\n```\n\nFor more options see [examples](examples) directory.\n\n### Options\n\nThis is a list of possible options that can be passed when creating a logger instance:\n\n* `enabled` if logger can write to the log files. Default: `true`.\n* `log_date_format` log date format. Default: `Y-m-d H:i:s`.\n* `log_file_extension` log file extension. Default: `log`.\n* `log_path:` log path where log files will be written. If not specified or not writable, modify `Logger::enabled` property to `false`.\n* `log_file_permissions` log files permissions. Default: `0644`, read and write for owner, read for everybody else.\n* `log_indented` message indentation. Default: `true`.\n* `log_threshold` log threshold. Default: `1` or `error`. Accepts single values or array of values. Accept single or array of values. Accepted values: `error`, `debug`, `info`, `warning`, `all`.\n\n### Methods\n\n| Method | Description |\n|---|---|\n| \u003ca href=\"#logger_log\"\u003e`log()`\u003c/a\u003e | Static function that write a log message line into the default log system, new or empty log system. |\n| \u003ca href=\"#logger_write\"\u003e`write()`\u003c/a\u003e | Write a log message line. |\n\n#### Method Details\n\n##### \u003ca name=\"logger_log\"\u003e\u003c/a\u003e Method: `log()`\n\n```php\n/**\n * Log a message into the default log system. If the log system does not exists, will create a new one.\n *\n * @param int $level log message level. Accepts: `debug`, `error`, `info` and `warning` messages.\n * @param string $message log message.\n *\n * @return bool \u003ccode\u003etrue\u003c/code\u003e if line was successfully wrote, \u003ccode\u003efalse\u003c/code\u003e otherwise.\n */\npublic static function log($level, $message): bool\n```\n\n**Examples**\n\n```php\n// debug message\nLogger::log('debug', 'Debug message');\n// error message\nLogger::log('error', 'Error message');\n// info message\nLogger::log('info', 'Informative message');\n// warning message\nLogger::log('warning', 'Waring message');\n```\n\n##### \u003ca name=\"logger_write\"\u003e\u003c/a\u003e Method: `write()`\n\n```php\n/**\n * Write a log message line.\n *\n * @param string $level Error log level.\n * @param string $message Error log message.\n *\n * @return bool True if line was successfully wrote.\n */\npublic static function write($level, $message): void\n```\n\n**Examples**\n\n```php\n// debug message\n$logger-\u003ewrite('debug', 'Debug message');\n// error message\n$logger-\u003ewrite('error', 'Error message');\n// info message\n$logger-\u003ewrite('info', 'Informative message');\n// warning message\n$logger-\u003ewrite('warning', 'Waring message');\n```\n## License\nThis project is under the MIT license. For more information see See [LICENSE](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fialopezg%2Flogger","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fialopezg%2Flogger","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fialopezg%2Flogger/lists"}