{"id":17749420,"url":"https://github.com/oresoftware/log-prepend","last_synced_at":"2026-05-01T09:32:05.134Z","repository":{"id":95712567,"uuid":"102056371","full_name":"ORESoftware/log-prepend","owner":"ORESoftware","description":"Create a function like console.log or console.error, but with a prepended string on each line.","archived":false,"fork":false,"pushed_at":"2018-07-19T04:25:04.000Z","size":23,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-23T12:35:37.684Z","etag":null,"topics":["javascript","logging","nodejs","stderr","stdout","stream","streaming"],"latest_commit_sha":null,"homepage":"","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/ORESoftware.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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":"2017-09-01T00:16:08.000Z","updated_at":"2018-07-19T04:25:05.000Z","dependencies_parsed_at":null,"dependency_job_id":"e5cbb13c-fef2-48f7-8bcc-5efad1a509d1","html_url":"https://github.com/ORESoftware/log-prepend","commit_stats":{"total_commits":29,"total_committers":1,"mean_commits":29.0,"dds":0.0,"last_synced_commit":"1cd2174b97388aa85e46dca009c6941e08e4ec0a"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ORESoftware%2Flog-prepend","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ORESoftware%2Flog-prepend/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ORESoftware%2Flog-prepend/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ORESoftware%2Flog-prepend/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ORESoftware","download_url":"https://codeload.github.com/ORESoftware/log-prepend/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246604610,"owners_count":20804100,"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":["javascript","logging","nodejs","stderr","stdout","stream","streaming"],"created_at":"2024-10-26T11:23:13.817Z","updated_at":"2026-05-01T09:32:05.106Z","avatar_url":"https://github.com/ORESoftware.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# log-prepend\n\nCreate a console.log or console.error like function, but prepend a string to each line.\n\n## API\n\n```js\nconst {lp} = require('log-prepend');\nconst log = lp(' [suman] ', process.stdout);\nconst logerr = lp(' [suman error] ', process.stderr);\n\nlog('a','b','c');\nlog('log1', 'log2\\n3',4,5 + '\\n55');\n\n```\n\nTo use colors in the prepending string, simply do:\n\n```js\nconst chalk = require('chalk');\nconst log = lp(chalk.blue(' [suman] '), process.stdout);\nconst logerr = lp(chalk.red(' [suman error] '), process.stderr);\n```\n\n\n# Extra\n\nThis works as a rudimentary solution:\n\n```js\nconst log = console.log.bind(console, ' [suman] ');\n```\n\nBut the problem with the above log function is that it won't handle new lines chars that are passed to it.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foresoftware%2Flog-prepend","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foresoftware%2Flog-prepend","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foresoftware%2Flog-prepend/lists"}