{"id":19044186,"url":"https://github.com/sevenecks/xlog","last_synced_at":"2026-06-19T04:31:37.021Z","repository":{"id":62542747,"uuid":"126240648","full_name":"sevenecks/xlog","owner":"sevenecks","description":"psr3 compliant(ish) logger with color support","archived":false,"fork":false,"pushed_at":"2018-04-11T15:15:58.000Z","size":34,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-21T23:18:00.233Z","etag":null,"topics":["color","logging","php","psr3"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sevenecks.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":null,"code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-03-21T21:06:45.000Z","updated_at":"2018-04-11T15:16:00.000Z","dependencies_parsed_at":"2022-11-02T15:46:36.165Z","dependency_job_id":null,"html_url":"https://github.com/sevenecks/xlog","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/sevenecks/xlog","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sevenecks%2Fxlog","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sevenecks%2Fxlog/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sevenecks%2Fxlog/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sevenecks%2Fxlog/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sevenecks","download_url":"https://codeload.github.com/sevenecks/xlog/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sevenecks%2Fxlog/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34517748,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-19T02:00:06.005Z","response_time":61,"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":["color","logging","php","psr3"],"created_at":"2024-11-08T22:45:09.528Z","updated_at":"2026-06-19T04:31:37.004Z","avatar_url":"https://github.com/sevenecks.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Xlog\n\n[![Latest Version on Packagist][ico-version]][link-packagist]\n[![Software License][ico-license]](LICENSE.md)\n[![Build Status][ico-travis]][link-travis]\n[![Coverage Status][ico-scrutinizer]][link-scrutinizer]\n[![Quality Score][ico-code-quality]][link-code-quality]\n[![Total Downloads][ico-downloads]][link-downloads]\n\nA psr-3 compliant logging module with color support for each different logging level.\n\n## Installation\n\nVia Composer\n\n```bash\ncomposer require sevenecks/xlog\n```\n\n## Usage\n\n```php\nrequire_once __DIR__ . '/vendor/autoload.php';\nrequire('src/Logger.php');\n\nuse SevenEcks\\Xlog\\Logger;\n\n$xlog = new Logger;;\n$xlog-\u003eclearLog();\n$xlog-\u003eemergency('test');\n$xlog-\u003ealert('test');\n$xlog-\u003ecritical('test');\n$xlog-\u003eerror('test');\n$xlog-\u003ewarning('test');\n$xlog-\u003enotice('test');\n$xlog-\u003einfo('test');\n$xlog-\u003edebug('test');\n```\n\n### Bash Usage\n\nAfter logging some stuff you can cat your log file and see all the pretty colors.\n\n```bash\ncat xlog.log\n```\n\n### Colors\n\nAll colors are created using ANSI color codes from Colorizer that is a part of this [ANSI](https://github.com/SevenEcks/ansi) module.\n\n```\nEmergency =\u003e Red\nAlert =\u003e Light Red\nCritical =\u003e Purple\nError =\u003e Light Purple\nWarning =\u003e Yellow\nNotice =\u003e Light Gray\nInfo =\u003e White\nDebug =\u003e Cyan\n```\n\n## API\n\nThe [PSR-3 Logger Interface](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md) defines the core of the API that this logging package uses.\n\n```php\n/**\n * System is unusable.\n *\n * @param string $message\n * @param array $context\n * @return void\n */\npublic function emergency($message, array $context = array());\n\n/**\n * Action must be taken immediately.\n *\n * Example: Entire website down, database unavailable, etc. This should\n * trigger the SMS alerts and wake you up.\n *\n * @param string $message\n * @param array $context\n * @return void\n */\npublic function alert($message, array $context = array());\n\n/**\n * Critical conditions.\n *\n * Example: Application component unavailable, unexpected exception.\n *\n * @param string $message\n * @param array $context\n * @return void\n */\npublic function critical($message, array $context = array());\n\n/**\n * Runtime errors that do not require immediate action but should typically\n * be logged and monitored.\n *\n * @param string $message\n * @param array $context\n * @return void\n */\npublic function error($message, array $context = array());\n\n/**\n * Exceptional occurrences that are not errors.\n *\n * Example: Use of deprecated APIs, poor use of an API, undesirable things\n * that are not necessarily wrong.\n *\n * @param string $message\n * @param array $context\n * @return void\n */\npublic function warning($message, array $context = array());\n\n/**\n * Normal but significant events.\n *\n * @param string $message\n * @param array $context\n * @return void\n */\npublic function notice($message, array $context = array());\n\n/**\n * Interesting events.\n *\n * Example: User logs in, SQL logs.\n *\n * @param string $message\n * @param array $context\n * @return void\n */\npublic function info($message, array $context = array());\n\n/**\n * Detailed debug information.\n *\n * @param string $message\n * @param array $context\n * @return void\n */\npublic function debug($message, array $context = array());\n\n/**\n * Logs with an arbitrary level.\n *\n * @param mixed $level\n * @param string $message\n * @param array $context\n * @return void\n */\npublic function log($level, $message, array $context = array());\n```\n\nOn top of that functionality is the ability to use dependency injection to configure the logging object, via constructor injection:\n\n```php\npublic function __construct($file_name = 'xlog.log', $append_to_file = true, $string_utils = null, ColorInterface $colorize = null)\n```\n\nThe constructor takes the file name, the $append_to_file (it should probably always be on), the $string_utils object, and the ColorInterface object. If none of these are provided, the constructor will create them based on the defaults. If you are happy with the module as it is, you don't need to pass any constructor arguments aside from perhaps the $file_name.\n\n```php\n/**\n * Clear the log file\n *\n * @return int\n */\npublic function clearLog()\n```\n\nThis will clear the log file. It can be called after object instantiation if you want a fresh log, or really at any point.\n\n## ToDo\n\n1. Add ability for capped logs, where the log automatically prunes older items after a certain amount of rows\n\n## Contributing\n\nPlease see [CONTRIBUTING](CONTRIBUTING.md) and [CODE_OF_CONDUCT](CODE_OF_CONDUCT.md) for details.\n\n## Security\n\nIf you discover any security related issues, please email bbutts@stormcode.net instead of using the issue tracker.\n\n## Credits\n\n- [Brendan Butts][link-author]\n- [All Contributors][link-contributors]\n## Change Log\nPlease see [Change Log](CHANGELOG.md) for more information.\n\n## License\n\nThe MIT License (MIT). Please see [License File](LICENSE.md) for more information.\n\n[ico-version]: https://img.shields.io/packagist/v/sevenecks/xlog.svg?style=flat-square\n[ico-license]: https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square\n[ico-travis]: https://img.shields.io/travis/sevenecks/xlog/master.svg?style=flat-square\n[ico-scrutinizer]: https://img.shields.io/scrutinizer/coverage/g/sevenecks/xlog.svg?style=flat-square\n[ico-code-quality]: https://img.shields.io/scrutinizer/g/sevenecks/xlog.svg?style=flat-square\n[ico-downloads]: https://img.shields.io/packagist/dt/sevenecks/xlog.svg?style=flat-square\n\n[link-packagist]: https://packagist.org/packages/sevenecks/xlog\n[link-travis]: https://travis-ci.org/sevenecks/xlog\n[link-scrutinizer]: https://scrutinizer-ci.com/g/sevenecks/xlog/code-structure\n[link-code-quality]: https://scrutinizer-ci.com/g/sevenecks/xlog\n[link-downloads]: https://packagist.org/packages/sevenecks/xlog\n[link-author]: https://github.com/sevenecks\n[link-contributors]: ../../contributors\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsevenecks%2Fxlog","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsevenecks%2Fxlog","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsevenecks%2Fxlog/lists"}