{"id":19437779,"url":"https://github.com/architect/logs","last_synced_at":"2025-04-24T21:32:11.470Z","repository":{"id":35008911,"uuid":"195887724","full_name":"architect/logs","owner":"architect","description":"manage @architect Function logs","archived":false,"fork":false,"pushed_at":"2024-04-30T15:58:53.000Z","size":554,"stargazers_count":4,"open_issues_count":0,"forks_count":4,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-11-08T12:06:25.062Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/architect.png","metadata":{"files":{"readme":"readme.md","changelog":"changelog.md","contributing":".github/contributing.md","funding":null,"license":"LICENSE","code_of_conduct":".github/code_of_conduct.md","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-07-08T21:20:57.000Z","updated_at":"2024-09-29T23:50:55.000Z","dependencies_parsed_at":"2023-02-12T06:01:08.958Z","dependency_job_id":"c7dd314f-1830-4043-ba33-eadb64c7cc86","html_url":"https://github.com/architect/logs","commit_stats":{"total_commits":262,"total_committers":10,"mean_commits":26.2,"dds":0.4961832061068703,"last_synced_commit":"e21ac546d4b69ceb85ee08d4b1fa08ce91ed4e5a"},"previous_names":[],"tags_count":66,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/architect%2Flogs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/architect%2Flogs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/architect%2Flogs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/architect%2Flogs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/architect","download_url":"https://codeload.github.com/architect/logs/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223968126,"owners_count":17233445,"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-11-10T15:15:52.835Z","updated_at":"2024-11-10T15:15:53.506Z","avatar_url":"https://github.com/architect.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# `@architect/logs` [![GitHub CI status](https://github.com/architect/logs/workflows/Node%20CI/badge.svg)](https://github.com/architect/logs/actions?query=workflow%3A%22Node+CI%22)\n\u003c!-- [![codecov](https://codecov.io/gh/architect/logs/branch/master/graph/badge.svg)](https://codecov.io/gh/architect/logs) --\u003e\n\n[@architect/logs][npm] is a module that retrieves and clears logs associated to\nyour @architect functions across environments.\n\n## Installation\n\n    npm i @architect/logs\n    let logs = require('@architect/logs')\n\n# API\n\n## `logs({pathToCode, verbose, destroy, production}, callback)`\n\nTakes a parameter object as first argument which accepts the following properties:\n\n- `pathToCode`: **required** the local path to architect Function code relative\n    to the current working directory, i.e. `src/http/get-index`\n- `verbose`: verbose super chatty mode\n- `destroy`: if truthy will delete logs via [`logs.destroy`][destroy], otherwise will\n    read logs via [`logs.read`][read]\n- `production`: if truthy will target your arc project's production environment,\n    otherwise will default to staging\n\nBy default will [read][read] logs from the staging environment. If the `destroy`\nproperty is truthy, logs instead will be [destroyed][destroy].\n\n## `logs.read({name, pathToCode, ts}, callback)`\n\nWill read logs from [`aws.CloudWatchLogs`][cloudwatchlogs], invoking\n[`getLogEvents`][getlogevents] for log retrieval.\n\nTakes a parameter object as first argument which accepts the following properties:\n\n- `name`: the CloudFormation `StackName` passed to\n    [`listStackResources`][liststack] within which to search Function logs. Note\n    that this is inferred from your application name, environment and specific\n    function you are querying - tread carefully!\n- `pathToCode`: **required** the local path to architect Function code relative\n    to the current working directory, i.e. `src/http/get-index`\n- `ts`: timestamp to use as a start time for displaying length of time details\n    (i.e. `Date.now()`)\n\n`callback` will be invoked with an error if an error arises during execution.\nOtherwise, `callback` will be invoked without arguments.\n\n## `logs.destroy({name, pathToCode, ts}, callback)`\n\nWill delete logs from [`aws.CloudWatchLogs`][cloudwatchlogs], invoking\n[`deleteLogGroup`][deleteloggroup].\n\nTakes a parameter object as first argument which accepts the following properties:\n\n- `name`: the CloudFormation `StackName` passed to\n    [`listStackResources`][liststack] within which to search Function logs. Note\n    that this is inferred from your application name, environment and specific\n    function you are querying - tread carefully!\n- `pathToCode`: **required** the local path to architect Function code relative\n    to the current working directory, i.e. `src/http/get-index`\n- `ts`: timestamp to use as a start time for displaying length of time details\n    (i.e. `Date.now()`)\n\n`callback` will be invoked with an error if an error arises during execution.\nOtherwise, `callback` will be invoked without arguments.\n\n[npm]: https://www.npmjs.com/package/@architect/logs\n[read]: #logsreadname-pathtocode-ts-callback\n[destroy]: #logsdestroyname-pathtocode-ts-callback\n[liststack]: https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/CloudFormation.html#listStackResources-property\n[cloudwatchlogs]: https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/CloudWatchLogs.html\n[getlogevents]: https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/CloudWatchLogs.html#getLogEvents-property\n[deleteloggroup]: https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/CloudWatchLogs.html#deleteLogGroup-property\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farchitect%2Flogs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Farchitect%2Flogs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farchitect%2Flogs/lists"}