{"id":20747600,"url":"https://github.com/s3pweb/s3pweb-logger","last_synced_at":"2025-07-06T18:14:10.075Z","repository":{"id":43924526,"uuid":"157216616","full_name":"s3pweb/s3pweb-logger","owner":"s3pweb","description":"A simple lib to log message using bunyan to console, file and logstash.","archived":false,"fork":false,"pushed_at":"2024-01-29T21:28:49.000Z","size":1655,"stargazers_count":4,"open_issues_count":3,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-13T19:26:16.832Z","etag":null,"topics":["bunyan","console","file","logger","logging","logstash","nodejs"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/s3pweb.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2018-11-12T13:18:58.000Z","updated_at":"2023-01-20T14:46:30.000Z","dependencies_parsed_at":"2023-02-12T03:00:34.505Z","dependency_job_id":"86d99e92-e024-451b-8cc2-2b7830374f91","html_url":"https://github.com/s3pweb/s3pweb-logger","commit_stats":{"total_commits":127,"total_committers":5,"mean_commits":25.4,"dds":"0.39370078740157477","last_synced_commit":"5b0f6cc1a3b1ed16a625e1fed0866aaf5e696e6a"},"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/s3pweb%2Fs3pweb-logger","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/s3pweb%2Fs3pweb-logger/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/s3pweb%2Fs3pweb-logger/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/s3pweb%2Fs3pweb-logger/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/s3pweb","download_url":"https://codeload.github.com/s3pweb/s3pweb-logger/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251311332,"owners_count":21569008,"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":["bunyan","console","file","logger","logging","logstash","nodejs"],"created_at":"2024-11-17T08:13:49.531Z","updated_at":"2025-04-28T12:02:35.904Z","avatar_url":"https://github.com/s3pweb.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![npm (scoped)](https://img.shields.io/npm/v/@s3pweb/s3pweb-logger)](https://www.npmjs.com/package/@s3pweb/s3pweb-logger)\n\nThis is a simple lib to log messages built on top of [bunyan](https://github.com/trentm/node-bunyan).\nThis lib can send logs to the console, to a file or to a logstash instance.\n\n# Installation\n\n    npm install @s3pweb/s3pweb-logger\n\n# Configuration\n\nThe constructor expect a config object following this format:\n\n```json\n{\n  \"name\": \"your-application-name\",\n  \"logger\": {\n    \"source\": false,\n    \"console\": {\n      \"enable\": true,\n      \"level\": \"debug\"\n    },\n    \"file\": {\n      \"enable\": true,\n      \"level\": \"info\",\n      \"dir\": \"./logs\",\n      \"addHostnameToPath\": true\n    },\n    \"server\": {\n      \"enable\": true,\n      \"level\": \"trace\",\n      \"url\": \"0.0.0.0\",\n      \"port\": \"9998\",\n      \"type\": \"elk\"\n    },\n    \"ringBuffer\": {\n      \"enable\": true,\n      \"size\": 5\n    }\n  }\n}\n```\n\n# Example\n\n```js\nconst Logger = require('@s3pweb/s3pweb-logger')\n\nconst log = new Logger(config).get()\nconst child = log.child({ child: 'childName' })\n\nlog.info('one message from log')\nchild.info('one message from child')\n```\n\n# Tests\n\nSet the name of your environment with NODE_ENV=xxxx before node\n\n```bash\nNODE_ENV=test node example/example.js\n```\n\n# Bonus\n\nTo start a ELK stack on docker :\n\n```bash\nchmod +x example/startElk.sh \n\n./example/startElk.sh\n```\n\nOr with docker compose :\n\n```bash\ndocker-compose -f example/docker-stack.yaml up -d\n```\n\nOpen your favorite browser : http://localhost:5601\n\nCreate an index with just * (replace logstash-* by *)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fs3pweb%2Fs3pweb-logger","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fs3pweb%2Fs3pweb-logger","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fs3pweb%2Fs3pweb-logger/lists"}