{"id":18508099,"url":"https://github.com/imqueue/async-logger","last_synced_at":"2025-10-04T13:54:16.695Z","repository":{"id":42914619,"uuid":"249189907","full_name":"imqueue/async-logger","owner":"imqueue","description":"Configurable async logger over winston for @imqueue services","archived":false,"fork":false,"pushed_at":"2024-11-08T11:35:59.000Z","size":880,"stargazers_count":1,"open_issues_count":3,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-23T22:38:11.664Z","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":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/imqueue.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-03-22T13:32:06.000Z","updated_at":"2024-11-08T11:36:02.000Z","dependencies_parsed_at":"2023-02-06T12:00:37.635Z","dependency_job_id":null,"html_url":"https://github.com/imqueue/async-logger","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imqueue%2Fasync-logger","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imqueue%2Fasync-logger/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imqueue%2Fasync-logger/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imqueue%2Fasync-logger/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/imqueue","download_url":"https://codeload.github.com/imqueue/async-logger/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247896410,"owners_count":21014507,"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-06T15:13:22.853Z","updated_at":"2025-10-04T13:54:16.669Z","avatar_url":"https://github.com/imqueue.png","language":"TypeScript","readme":"# @imqueue/async-logger\n\nConfigurable async logger over winston for @imqueue services.\n\n## Install\n\n~~~bash\nnpm i --save @imqueue/async-logger\n~~~\n\n## Usage\n\nThere are two actual ways of using async logger.\n\n1. Rely on singleton instance produced by this library, which is configured by\n   environment variables (see Configuration section below)\n\n   In this case as simple as\n   ~~~typescript\n   import logger from '@imqueue/async-logger';\n\n   serviceOptions.logger = logger;\n   ~~~\n\n2. Instantiate and configure async logger programmatically:\n   ~~~typescript\n   import { Logger } from '@imqueue/async-logger';\n\n   const { name, version } = require('./package.json');\n\n   const logger = new Logger({\n       transports: [{\n           type: 'http',\n           options: {\n               ssl: true,\n               port: 443,\n               path: '/v1/input/\u003cYOUR_API_KEY\u003e',\n               host: 'http-intake.logs.datadoghq.com',\n               headers: {\n                   'Content-Type': 'application/json',\n               },\n           },\n           enabled: true,\n       }],\n       metadata: {\n           ddsource: `${ name } ${ version }`,\n           ddtags: 'env: dev',\n           hostname: 'localhost'\n       },\n   });\n\n   serviceOptions.logger = logger;\n   ~~~\n\n## Configuration\n\nLogger can be configured via environment variables. It can be easily integrated\nwith any remote services. Here we will example configuration based on assumption\nto connect with Datadog remote service.\n\nSo, basically there are two basic configuration options available:\n\n~~~bash\nexport LOGGER_TRANSPORTS='[]'\nexport LOGGER_METADATA='{}'\n~~~\n\nBoth of them are simply JSON strings referring to replicate corresponding\nwinston logger settings. Both of them can accept string tags `%name`, `%version`\nfor dynamic setting of these values from a current service package, if needed.\n\n1. To configure HTTP transport follow to pass such object to `LOGGER_TRANSPORTS`\narray:\n\n~~~json\n{\n    \"type\": string,\n    \"options\": {\n        \"ssl\": boolean,\n        \"port\": number,\n        \"path\": string,\n        \"host\": string,\n        \"headers\": object\n    },\n    \"enabled\": boolean\n}\n~~~\n\n2. To configure File transport\n\n~~~json\n{\n    \"type\": string,\n    \"options\": {\n        \"filename\": string,\n        \"dirname\": string,\n        \"options\": object,\n        \"maxsize\": number,\n        \"zippedArchive\": boolean,\n        \"maxFiles\": number,\n        \"eol\": string,\n        \"tailable\": boolean\n    },\n    \"enabled\": boolean\n}\n~~~\n\nEXAMPLE FOR DATADOG:\n\n~~~bash\nexport LOGGER_TRANSPORTS='[{\"type\":\"http\",\"options\":{\"ssl\":true,\"port\":443,\"path\":\"/v1/input/[DATADOG_API_KEY]\",\"host\":\"http-intake.logs.datadoghq.com\",\"headers\":{\"Content-Type\":\"application/json\"}}, \"enabled\": true }]'\n~~~\n\nwhere DATADOG_API_KEY should be replaced with an actual API key.\n\n3. To configure metadata consider the following `LOGGER_METADATA` object:\n\n~~~json\n{\n    \"ddsource\": string,\n    \"ddtags\": string,\n    \"hostname\": string\n}\n~~~\n\nEXAMPLE FOR DATADOG:\n\n~~~bash\nexport LOGGER_METADATA='{\"ddsource\":\"%name %version\",\"ddtags\":\"env: dev\",\"hostname\":\"localhost\"}'\n~~~\n\n### Lets See It Human-Readable:\n\n~~~bash\n# example of transports config\nexport LOGGER_TRANSPORTS='[{\n    \"type\": \"http\",\n    \"options\": {\n        \"ssl\": true,\n        \"port\": 443,\n        \"path\": \"/v1/input/\u003cYOUR_API_KEY\u003e\",\n        \"host\": \"http-intake.logs.datadoghq.com\",\n        \"headers\": {\n            \"Content-Type\": \"application/json\"\n        }\n    },\n    \"enabled\": true\n}, {\n    \"type\": \"file\",\n    \"options\": {\n        \"filename\": \"logs.log\",\n        \"dirname\": \"/home/usr/logs\",\n        \"options\": object,\n        \"zippedArchive\": false,\n    }\n    \"enabled\": true\n}]'\n# example of metadata for datadog\nexport LOGGER_METADATA='{\n    \"ddsource\": \"%name %version\",\n    \"ddtags\": \"env: dev\",\n    \"hostname\": \"localhost\"\n}';\n~~~\n\n## Contributing\n\nAny contributions are greatly appreciated. Feel free to fork, propose PRs, open\nissues, do whatever you think may be helpful to this project. PRs which passes\nall tests and do not brake tslint rules are first-class candidates to be\naccepted!\n\n## License\n\nThis project is licensed under the GNU General Public License v3.0.\nSee the [LICENSE](LICENSE)\n\nHappy Coding!\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fimqueue%2Fasync-logger","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fimqueue%2Fasync-logger","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fimqueue%2Fasync-logger/lists"}