{"id":18974988,"url":"https://github.com/bufferapp/js-bufflog","last_synced_at":"2025-04-19T16:44:13.907Z","repository":{"id":38722105,"uuid":"242115008","full_name":"bufferapp/js-bufflog","owner":"bufferapp","description":"logger for all javascript and typescript Buffer services","archived":false,"fork":false,"pushed_at":"2024-11-28T12:12:52.000Z","size":152,"stargazers_count":0,"open_issues_count":4,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-29T10:23:29.242Z","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/bufferapp.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,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-02-21T10:37:38.000Z","updated_at":"2024-11-28T12:12:55.000Z","dependencies_parsed_at":"2024-06-21T15:35:22.302Z","dependency_job_id":"cf78c744-a79a-4081-b04b-cba96bfb883b","html_url":"https://github.com/bufferapp/js-bufflog","commit_stats":{"total_commits":53,"total_committers":4,"mean_commits":13.25,"dds":"0.16981132075471694","last_synced_commit":"7d09996a522d80395b2b462337305be39cdf246b"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bufferapp%2Fjs-bufflog","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bufferapp%2Fjs-bufflog/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bufferapp%2Fjs-bufflog/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bufferapp%2Fjs-bufflog/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bufferapp","download_url":"https://codeload.github.com/bufferapp/js-bufflog/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249223962,"owners_count":21232842,"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-08T15:16:53.471Z","updated_at":"2025-04-16T09:34:24.979Z","avatar_url":"https://github.com/bufferapp.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# js-bufflog\nlogger for all javascript and typescript Buffer services\n\n## Install\n`npm i @bufferapp/bufflog`\n\n## Usage\n```js\n\n// CommonJS style\nconst Bufflog = require('@bufferapp/bufflog');\n\n// ES6 style\nimport Bufflog  from \"@bufferapp/bufflog\";\n\nBufflog.debug('hello critical', {\"some\":\"stuff\"});\nBufflog.info('hello info');\nBufflog.notice('hello notice with context', {\"foo\":\"bar\"});\nBufflog.error('hello error');\nBufflog.critical('hello critical');\n```\n\n## Log verbosity levels\n\nIf you wish to see more logs, simply set the `LOG_LEVEL` to the desired level. Here a list with some use case:\n\n| Levels  | Use case  | Examples  |\n|:-:|---|---|\n| DEBUG  | Information used for interactive investigation, with no long-term value. Activate it with `LOG_LEVEL=DEBUG`| Printing function names, steps inside a function. |\n| INFO | Interesting events. Track the general flow of the application.  Activate it with `LOG_LEVEL=INFO`| User logs in, SQL logs, worker process/delete a message... |\n| NOTICE | Uncommon events. **This is the default verbosity level**. |  Missing environment variables, page redirection, pod starting/restarting/terminating, retrying to query an API... |\n| WARNING | Exceptional occurrences that are not errors. Undesirable things that are not necessarily wrong. | Use of deprecated APIs,  poor use of an API, unauthorized access, pod restart because of memory limit ... |\n| ERROR | Runtime errors. Highlight when the current flow of execution is stopped due to a failure. | Exceptions messages, incorect credentials or permissions...  |\n| CRITICAL  | Critical conditions. Describe an unrecoverable application, system crash, or a catastrophic failure that requires immediate attention.  | Application component unavailable, unexpected exception. entire website down, database unavailable ...|\n\n\n## Add traces to log\n\nA great feature of Datadog is to correlate traces and logs to make troubleshooting easier. \n\nTo take advantage of this, you will need to:\n- install the `dd-trace` package \n- import it and init it with `logInjection:true`. \n- BuffLog will append automatically the traces to the logs (only within a request)\n\n```js\n// make sure to put those lines at the very beginning of your service\nimport tracer from \"dd-trace\";\ntracer.init({\n    //  will automatically append the traces to BuffLog\n    logInjection: true\n\n    // ... all other options...\n});\n```\n\n## Use bufflog middleware with express\n```js\nconst app = express();\napp.use(Bufflog.middleware())\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbufferapp%2Fjs-bufflog","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbufferapp%2Fjs-bufflog","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbufferapp%2Fjs-bufflog/lists"}