{"id":21745130,"url":"https://github.com/dissfall/winston-microlog","last_synced_at":"2026-04-12T20:49:19.126Z","repository":{"id":51771387,"uuid":"199137602","full_name":"Dissfall/winston-microlog","owner":"Dissfall","description":"Log manager provides simple and clear logging system that in convenient to use for microservices. Uses winston","archived":false,"fork":false,"pushed_at":"2021-05-11T00:27:45.000Z","size":205,"stargazers_count":1,"open_issues_count":2,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-28T06:26:21.062Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://dissfall.github.io/winston-microlog/","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Dissfall.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"patreon":"dissfall","ko_fi":"dissfall"}},"created_at":"2019-07-27T08:23:40.000Z","updated_at":"2022-02-01T12:42:43.000Z","dependencies_parsed_at":"2022-09-06T10:01:29.571Z","dependency_job_id":null,"html_url":"https://github.com/Dissfall/winston-microlog","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Dissfall%2Fwinston-microlog","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Dissfall%2Fwinston-microlog/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Dissfall%2Fwinston-microlog/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Dissfall%2Fwinston-microlog/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Dissfall","download_url":"https://codeload.github.com/Dissfall/winston-microlog/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244722654,"owners_count":20499153,"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-26T07:13:43.932Z","updated_at":"2026-04-12T20:49:19.030Z","avatar_url":"https://github.com/Dissfall.png","language":"TypeScript","funding_links":["https://patreon.com/dissfall","https://ko-fi.com/dissfall","https://ko-fi.com/N4N510AEO","https://www.patreon.com/join/dissfall?"],"categories":[],"sub_categories":[],"readme":"# winston-microlog\n\nLog manager provides simple and clear logging sysmem convenient to use for microservices.\n\n[![NPM](https://nodei.co/npm/winston-microlog.png?downloads=true\u0026downloadRank=true)](https://nodei.co/npm/winston-microlog/)\n\n[![npm Downloads](https://img.shields.io/npm/dm/winston-microlog.svg?style=flat-square)](https://npmcharts.com/compare/winston-microlog?minimal=true)\n[![commit activity](https://img.shields.io/github/commit-activity/m/dissfall/winston-microlog?style=flat-square)](https://github.com/Dissfall/winston-microlog/commits/master)\n[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier)\n\u003c/br\u003e\u003c/br\u003e\n[![ko-fi](https://www.ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/N4N510AEO)\n\n[![Become a patron](https://c5.patreon.com/external/logo/become_a_patron_button.png)](https://www.patreon.com/join/dissfall?)\n\n## Motivation\n\n`winston-microlog` was developed in order to provide a way to keep logs from different sources (and parts of sources) in the most convenient and clear way. First of all, the project was created for microservices, where logs from different services are collected in one thread. Thus, the largest unit of logging is services. Services can include instances, which can be different functional parts of the service or just different files.\n\n```\n   Unit A1  Unit A2  Unit B1  Unit B2\n     |        |        |        |\n     |        |        |        |\n     |        |        |        |\n  +--v--------v--+  +--v--------v--+\n  |              |  |              |\n  |  Service A   |  |  Service B   |\n  |              |  |              |\n  +------+-------+  +------+-------+\n         |                 |\n         |                 |\n         |                 |\n         +---\u003e Logfile \u003c---+\n```\n## Useful resources\n * [API documentation](https://dissfall.github.io/winston-microlog/)\n * [winston repository](https://github.com/winstonjs/winston)\n\n## Usage\n\nTo start logging you need to initialize logger for every service and then for every instance.\n\nExample for one service:\n\nlogger.js\n``` js\nconst LogManager = require(\"winston-microlog\")[\"default\"];\n\nconst logManager = new LogManager('Service');\n\nexports[\"default\"] = logManager;\n```\n\ndb_connect.js\n``` js\nconst logManager = require('./logger')['default'];\n\nconst logger = logManager.getLogger('db-con');\n\nlogger.info('Connecting to database...');\nlet db = [{'data': 'data'}];\nlogger.info('Database succesfully connected!');\n\nexports['default'] = db;\n```\n\nindex.js\n``` js\nconst logManager = require('./logger')['default'];\nconst db = require('./db_connect')['default'];\n\nconst logger = logManager.getLogger('Main');\n\nlogger.info('Service started');\n\nlogger.err('Test error');\nlogger.warn('Test warning');\n```\n\nTo start `node index.js`\n\nResult:\n```\n@SERVICE  #DB-CON   [10:52]   ℹ| Connecting to database...\n@SERVICE  #DB-CON   [10:52]   ℹ| Database succesfully connected!\n@SERVICE  #MAIN     [10:52]   ℹ| Service started\n@SERVICE  #MAIN     [10:52]  ⛔| Test error\n@SERVICE  #MAIN     [10:52]   ⚠️| Test warning\n```\n## Importants\n### Execution context\nNote that if you want to pass logger in another module (function, class etc.) execution context wheel be changed and you need to pass logger with their context:\n``` js\nfunctionUsesLogger(logger.log.bind(logger));\n```\n### Using with container manager (like docker-compose)\nRecomendet way to use winston-logger with managers like docker-compose is hide service name (because it already provided) with [showService](https://dissfall.github.io/winston-microlog/interfaces/lmconfig.html#showservice)\n``` js\nconst logManager = new LogManager('Service', undefined, { showService: false });\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdissfall%2Fwinston-microlog","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdissfall%2Fwinston-microlog","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdissfall%2Fwinston-microlog/lists"}