{"id":23507360,"url":"https://github.com/simplyhexagonal/logger-cli","last_synced_at":"2025-05-12T15:51:00.672Z","repository":{"id":71910285,"uuid":"447793454","full_name":"simplyhexagonal/logger-cli","owner":"simplyhexagonal","description":"CLI wrapper for @simplyhexagonal/logger","archived":false,"fork":false,"pushed_at":"2022-01-16T03:21:33.000Z","size":272,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-05-06T20:28:59.954Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","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/simplyhexagonal.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2022-01-14T00:23:30.000Z","updated_at":"2022-01-14T02:10:18.000Z","dependencies_parsed_at":"2023-09-24T03:32:13.597Z","dependency_job_id":"33c8f7bb-e005-4efd-893a-9a6960a26f2d","html_url":"https://github.com/simplyhexagonal/logger-cli","commit_stats":{"total_commits":24,"total_committers":1,"mean_commits":24.0,"dds":0.0,"last_synced_commit":"4cf822f0d96d38fdd3b7cd24a72207c4bba09445"},"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simplyhexagonal%2Flogger-cli","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simplyhexagonal%2Flogger-cli/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simplyhexagonal%2Flogger-cli/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simplyhexagonal%2Flogger-cli/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/simplyhexagonal","download_url":"https://codeload.github.com/simplyhexagonal/logger-cli/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253525107,"owners_count":21922029,"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":[],"created_at":"2024-12-25T10:18:15.460Z","updated_at":"2025-05-12T15:51:00.650Z","avatar_url":"https://github.com/simplyhexagonal.png","language":"TypeScript","funding_links":["https://www.buymeacoffee.com/jeanlescure","https://opencollective.com/simplyhexagonal"],"categories":[],"sub_categories":[],"readme":"# Logger CLI\n![Tests](https://github.com/simplyhexagonal/logger-cli/workflows/tests/badge.svg)\n\nThis is a simple yet powerful wrapper around [@simplyhexagonal/logger](https://github.com/simplyhexagonal/logger) that provides\nCLI capabilities, including piping the output of a command to the logger:\n\n```sh\n$ logger.debug This is a debug message\n\n# [2022-01-13T23:54:00.600] DEBUG 🐞️:\n#\n#        This is a debug message\n\n$ uname -a | logger.debug\n\n# [2022-01-13T23:55:01.933Z] DEBUG 🐞️:\n# \n#        Linux 5.11.0-40-generic #44~20.04.2-Ubuntu SMP Tue Oct 26 18:55:01 UTC 2022 x86_64 GNU/Linux\n```\n\nMore importantly, configuring transports is supported as well!\n\nWe have the following officially supported transports:\n\n- [WebSocket]() (Coming soon)\n- [Discord](https://www.npmjs.com/package/@simplyhexagonal/logger-transport-discord)\n- [Slack]() (Coming soon)\n- [Email]() (Coming soon)\n- [SMS]() (Coming soon)\n\n## Open source notice\n\nThis project is open to updates by its users, [I](https://github.com/jeanlescure) ensure that PRs are relevant to the community.\nIn other words, if you find a bug or want a new feature, please help us by becoming one of the\n[contributors](#contributors-) ✌️ ! See the [contributing section](#contributing)\n\n## Like this module? ❤\n\nPlease consider:\n\n- [Buying me a coffee](https://www.buymeacoffee.com/jeanlescure) ☕\n- Supporting Simply Hexagonal on [Open Collective](https://opencollective.com/simplyhexagonal) 🏆\n- Starring this repo on [Github](https://github.com/simplyhexagonal/logger-cli) 🌟\n\n## Install\n\n```sh\n# recommended global install\nnpm install -g @simplyhexagonal/logger-cli\n\n# or as project dependency\npnpm i @simplyhexagonal/logger-cli\n\n# or\nyarn add @simplyhexagonal/logger-cli\n\n# or\nnpm install @simplyhexagonal/logger-cli\n```\n\n## Usage\n\n```sh\n# simply pass your message(s) as arguments\nlogger.\u003clog-level\u003e \u003cmessage\u003e [...message]\n\n# or pipe the output of a command to the logger\ncommand | logger.\u003clog-level\u003e\n```\n\nThe following log levels are supported:\n\n```sh\nlogger.debug\nlogger.info\nlogger.warn\nlogger.error\nlogger.fatal\nlogger.all\nlogger.raw\n```\n\n## Configuration\n\nBy default the logger will be configured to log to the console.\n\nTo configure the logger you can use the `logger.config` command:\n\n```sh\nlogger.config \u003cconfig-file\u003e.js\n```\n\nThe config file is expected to be a `.js` file that exports a `config` object, e.g.:\n\n```js\nconst os = require('os');\n\nmodule.exports = {\n  optionsByLevel: {\n    warn: [], // leaving this array means the logs will output to console\n    info: [\n      {\n        transport: 'discord',\n        options: {\n          destination: (process.env.DISCORD_WEBHOOK || ''),\n        },\n      },\n    ],\n    debug: [],\n    error: [\n      // you can configure more than one transport per log level\n      {\n        transport: 'discord',\n        options: {\n          destination: (process.env.DISCORD_WEBHOOK || ''),\n        },\n      },\n      {\n        transport: 'email',\n        options: {\n          destination: (process.env.ERROR_NOTIFICATION_EMAIL || ''),\n        },\n      },\n    ],\n    fatal: [],\n    all: [],\n    raw: [],\n  },\n  appIdentifiers: {\n    clusterType: 'TEST',\n    cluster: 'CI',\n    hostname: os.hostname(),\n    app: 'logger-cli',\n  },\n};\n```\n\nThis configuration file will be symlinked to `~/.config/logger/logger.config.js`. This means\nthat everywhere on your system that you logger-cli commands, you will be able to use the same\nconfiguration.\n\nAs you can see in the example above, you can also define environment variables and they will be\nused by @simplyhexagonal/logger-cli.\n\nFor more information on the available configuration options, please see [@simplyhexagonal/logger](https://github.com/simplyhexagonal/logger).\n\n## Contributing\n\nYes, thank you! This plugin is community-driven, most of its features are from different authors.\nPlease update the docs and tests and add your name to the `package.json` file.\n\n## Contributors ✨\n\nThanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):\n\n\u003c!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section --\u003e\n\u003c!-- prettier-ignore-start --\u003e\n\u003c!-- markdownlint-disable --\u003e\n\u003ctable\u003e\n  \u003ctr\u003e\n    \u003ctd align=\"center\"\u003e\u003ca href=\"https://jeanlescure.cr\"\u003e\u003cimg src=\"https://avatars2.githubusercontent.com/u/3330339?v=4\" width=\"100px;\" alt=\"\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eJean Lescure\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"#maintenance-jeanlescure\" title=\"Maintenance\"\u003e🚧\u003c/a\u003e \u003ca href=\"https://github.com/simplyhexagonal/package/commits?author=jeanlescure\" title=\"Code\"\u003e💻\u003c/a\u003e \u003ca href=\"#userTesting-jeanlescure\" title=\"User Testing\"\u003e📓\u003c/a\u003e \u003ca href=\"https://github.com/simplyhexagonal/package/commits?author=jeanlescure\" title=\"Tests\"\u003e⚠️\u003c/a\u003e \u003ca href=\"#example-jeanlescure\" title=\"Examples\"\u003e💡\u003c/a\u003e \u003ca href=\"https://github.com/simplyhexagonal/package/commits?author=jeanlescure\" title=\"Documentation\"\u003e📖\u003c/a\u003e\u003c/td\u003e\n\u003c/table\u003e\n\n\u003c!-- markdownlint-enable --\u003e\n\u003c!-- prettier-ignore-end --\u003e\n\u003c!-- ALL-CONTRIBUTORS-LIST:END --\u003e\n## License\n\nCopyright (c) 2022-Present [Package Contributors](https://github.com/simplyhexagonal/package/#contributors-).\u003cbr/\u003e\nLicensed under the [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimplyhexagonal%2Flogger-cli","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsimplyhexagonal%2Flogger-cli","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimplyhexagonal%2Flogger-cli/lists"}