{"id":28220940,"url":"https://github.com/morulus/logdock","last_synced_at":"2025-08-14T08:13:11.671Z","repository":{"id":66348141,"uuid":"116746541","full_name":"morulus/logdock","owner":"morulus","description":"More advanced tool for creating updatable CLI log,","archived":false,"fork":false,"pushed_at":"2018-10-07T23:06:54.000Z","size":538,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-24T12:55:21.189Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/morulus.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2018-01-09T00:56:58.000Z","updated_at":"2018-10-07T23:06:55.000Z","dependencies_parsed_at":"2023-02-24T18:15:46.803Z","dependency_job_id":null,"html_url":"https://github.com/morulus/logdock","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/morulus/logdock","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/morulus%2Flogdock","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/morulus%2Flogdock/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/morulus%2Flogdock/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/morulus%2Flogdock/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/morulus","download_url":"https://codeload.github.com/morulus/logdock/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/morulus%2Flogdock/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270385467,"owners_count":24574556,"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","status":"online","status_checked_at":"2025-08-14T02:00:10.309Z","response_time":75,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":"2025-05-18T04:16:31.487Z","updated_at":"2025-08-14T08:13:11.655Z","avatar_url":"https://github.com/morulus.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"logdock\n==\n\n**BETA!**\n\nMore advanced tool for creating updatable CLI log, including loaders, spinners, progress bars, groups, reports, etc.\n\n\n\nRead [Usage](https://github.com/morulus/logdock/blob/master/docs/usage.md) to best understood.\n\n### Api reference\n\n#### **.transform**`(handler : function | array\u003cfunc\u003e) : func`\n\nSpecify message transformer. The handler accepts a message and returns transformed message. To keep together multiple transform logic should pass an array of transformers, which will be executed as a flow.\n\n```js\nconst log = require('logdock')\nconst chalk = require('chalk')\n\nconst beautyLog = log.transform([\n  message =\u003e `[${message}]`,\n  chalk.bgBlack.white,\n]);\n```\n\n#### `log.group` (name : string) : func\n\nCreate new log function, which already have static left part. Group has title, that usually is simple string. If group title must be styled, you may specify transform before.\n\n```js\nconst log = require('logdock')\nconst chalk = require('chalk')\n\nconst appLog = log\n  .transform([\n    message =\u003e ` ${message} `,\n    chalk.bgBlack.white,\n  ])\n  .group('MyApp');\n```\n\nYou also pass transform as second argument.\n\n```js\nconst appLog = log\n  .group('MyApp', [\n    message =\u003e ` ${message} `,\n    chalk.bgBlack.white,\n  ]);\n```\n\n#### `log.config(name)`\n\nConfigurate and create new log function.  See [Config options](#config)  for ditails.\n\n```js\nconst log = require('logdock')\n\nconst summLog = log\n  .config({\n    separator: ' + '\n  })\n  .group('1')\n  .config({\n    separator: ' = '\n  })\n  .group('2')\n\nsummLog('3'); // 1 + 2 = 3\n```\n\n#### `log.stdout(stream)`\n\nCreate new log with custom stdout.\n\n```js\nconst log = require('logdock');\n\nconst wstream = fs.createWriteStream('output.txt');\n\nconst logToFile = log.stdout(wstream);\n```\n\n\n#### `log.output(handler)`\n\nSpecify custom output handler, which overrides internal output, and returns new log instance.\n\n```js\nconst log = require('logdock');\n\nconst myLog = log.output(msg =\u003e console.log(msg));\n```\n\nUsing custom output handler makes `log.stdout` useless.\n\n#### `.persist()`\n\n#### `.pipe`\n\nLink to the in-log pipe. Use it to translate any child-process stdout to the log.\n\n```js\nconst child = spawn('node',  ['some-child-process.js')], {\n  stdio: [process.stdin, 'pipe', 'inherit']\n});\n\nchild.stdout.pipe(childLog.stream);\n```\n\n\n#### `.done(lastMessage)`\n\n*Works only with default output!*\n\nRelease selected unit. After this, the unit message will be added to CLI log and removed from docks. There are no more iteractions with such unit will happends. And trying to pass another message will gives no effect.\n\n```js\nconst log = require('../lib');\nconst chalk = require('chalk');\n\nconst progressLog = log.transform(chalk.bold);\nconst title = progressLog.transform(chalk.bold.green);\nconst logX = progressLog.group('X').transform(chalk.blue);\nconst logY = progressLog.group('Y').transform(chalk.blue);\nconst logZ = progressLog.group('Z').transform(chalk.blue);\n\ntitle('Calc XYZ');\n\nlet x = 0;\nlet y = 0;\nlet z = 0;\nconst interval = setInterval(() =\u003e {\n  logX(`${x}%`);\n  logY(`${y}%`);\n  logZ(`${z}%`);\n\n  if (x \u003e= 100) {\n    logX.done('OK');\n  }\n  if (y \u003e= 100) {\n    logY.done('OK');\n  }\n  if (z \u003e= 100) {\n    logZ.done('OK');\n  }\n\n  x += 1;\n  y += 2;\n  z += 4;\n\n  if (x \u003e 100 \u0026\u0026 y \u003e 100 \u0026\u0026 z \u003e 100) {\n    clearInterval(interval);\n  }\n}, 10);\n```\n\n## Config\n\n#### `hideEmpty` (default: true)\n\nIf log accepts empty string, then its groups will be hidden.\n\n```js\nconst pure = log\n  .group('Pure:')\n  .config({\n    hideEmpty: false\n  })\n\nconst unpure = log\n  .group('Unpure:')\n  .config({\n    hideEmpty: true\n  })\n\npure(''); // [Will displays nothing]\nunpure(''); // Unpure:\n```\n\n#### `separator` (default: ' ')\n\nSpecify separator between messages\n\n```js\nconst log = require('../lib');\n\nconst summLog = log\n  .config({\n    separator: ' + '\n  })\n  .group('1')\n  .config({\n    separator: ' = '\n  })\n  .group('2');\n\nsummLog('3'); // 1 + 2 = 3\n```\n\n#### `streamStripEmptyTail` (default: true)\n\nRemove the trailing line breaks of outside stdout and stream chunks.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmorulus%2Flogdock","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmorulus%2Flogdock","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmorulus%2Flogdock/lists"}