{"id":18939065,"url":"https://github.com/monai/node-sconsole","last_synced_at":"2025-07-03T11:05:00.314Z","repository":{"id":33753851,"uuid":"37409108","full_name":"monai/node-sconsole","owner":"monai","description":"Unified logger to console and syslog","archived":false,"fork":false,"pushed_at":"2015-11-27T16:30:31.000Z","size":49,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"develop","last_synced_at":"2025-05-25T08:38:55.965Z","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":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/monai.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-06-14T11:00:46.000Z","updated_at":"2015-06-14T11:01:34.000Z","dependencies_parsed_at":"2022-09-13T18:02:24.394Z","dependency_job_id":null,"html_url":"https://github.com/monai/node-sconsole","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/monai/node-sconsole","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/monai%2Fnode-sconsole","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/monai%2Fnode-sconsole/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/monai%2Fnode-sconsole/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/monai%2Fnode-sconsole/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/monai","download_url":"https://codeload.github.com/monai/node-sconsole/tar.gz/refs/heads/develop","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/monai%2Fnode-sconsole/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261783470,"owners_count":23208957,"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-08T12:16:17.281Z","updated_at":"2025-07-03T11:05:00.294Z","avatar_url":"https://github.com/monai.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# node-sconsole\n\n[![Build Status](http://img.shields.io/travis/monai/node-sconsole/develop.svg)](https://travis-ci.org/monai/node-sconsole)\n[![NPM Version](http://img.shields.io/npm/v/sconsole.svg)](https://www.npmjs.org/package/sconsole)\n\nUnified logger to console and syslog.\n\n`npm install sconsole`\n\n## How to use\n\n```js\nvar sconsole = require('sconsole');\n\nsconsole.setup({\n    upto: sconsole.priority.info,\n    ident: 'my app',\n    stdio: true,\n    syslog: {\n        upto: sconsole.priority.error // overrides value in parent object\n    }\n});\n\nsconsole.error('error message');\nsconsole.warn('warning message');\nsconsole.info('info message');\n```\n## API\n\n### setup(options)\n\nOptions:\n\n- `upto` Number default=`sconsole.priority.debug` - log messages up to this priority.\n- `stdio` Boolean|Object - console output configuration.\n- `syslog` Boolean|Object - syslog output configuration.\n\n`stdio` and `syslog` object values can be defined in top priority options object. See example above.\n\n`stdio` options:\n\n- `true` - write to console using default options.\n- `false` - do not write to console.\n- `Object` - overrides parent options object. Specific options:\n    - `out` Stream - stdout stream for messages with priority \u003e=4.\n    - `err` Stream - stderr stream for messages with priority \u003c4.\n    - `format` Function - message format function.\n\n`syslog` options:\n\n- `true` - write to syslog using default options.\n- `false` - do not write to syslog.\n- `Object` - overrides parent options object. Specific options:\n    - `upto` Number default=`sconsole.priority.debug` - overrides top level option.\n    - `ident` String default=process.title - message prefix used in syslog.\n    - `facility` Number default=`sconsole.facility.user` - program type.\n    - `format` Function - message format function.\n\nFormat function arguments:\n\n- `data` Object - message data.\n- `options` Object - options object.\n\nFormat function is expected to return string.\n\n### Constants\n\n- `sconsole.priority` - log priority constants, see [constants.js](/lib/constants.js).\n- `sconsole.facility` - syslog facilities, see [constants.js](/lib/constants.js).\n\n### Priority and console methods\n\n`sconsole` is replacement for regular [console](https://iojs.org/api/console.html) module. It extends all console's methods so they work as expected, e.g. `sconsole.dir(obj, { colors: true })` will print colored object on iojs. On top of that `sconsole` has methods which represent syslogs' priorities, e.g. `sconsole.notice()`. The methods that are present in console and syslog has console's behavior and syslogs's priority. All the rest console's methods have `console.log()` behavior and `sconsole.priority.debug` priority.\n\nExample:\n\n- `sconsole.dir()` - `console.dir()` behavior, debug priority.\n- `sconsole.error()` - `console.error()` behavior, error priority.\n- `sconsole.notice()` - `console.log()` behavior, notice priority.\n\n## License\n\nISC\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmonai%2Fnode-sconsole","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmonai%2Fnode-sconsole","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmonai%2Fnode-sconsole/lists"}