mirror of
https://github.com/atlanticbiomedical/biomedjs.git
synced 2025-07-02 00:47:26 -04:00
46 lines
4.1 KiB
JSON
46 lines
4.1 KiB
JSON
{
|
|
"name": "log4node",
|
|
"description": "Logger for node cluster, compatible with logrotate",
|
|
"version": "0.1.2",
|
|
"author": {
|
|
"name": "Bertrand Paquet",
|
|
"email": "bertrand.paquet@gmail.com"
|
|
},
|
|
"keywords": [
|
|
"log",
|
|
"logger",
|
|
"cluster",
|
|
"logrotate"
|
|
],
|
|
"main": "./lib/log4node.js",
|
|
"homepage": "https://github.com/bpaquet/log4node",
|
|
"repository": {
|
|
"type": "git",
|
|
"url": "git://github.com/bpaquet/log4node.git"
|
|
},
|
|
"licenses": [
|
|
{
|
|
"type": "Apache2",
|
|
"url": "http://www.apache.org/licenses/LICENSE-2.0"
|
|
}
|
|
],
|
|
"devDependencies": {
|
|
"vows": "0.6.x",
|
|
"whereis": "0.0.2"
|
|
},
|
|
"scripts": {
|
|
"test": "./test-runner.sh"
|
|
},
|
|
"engines": {
|
|
"node": ">= 0.6.0"
|
|
},
|
|
"readme": "# Overview\n\nThis module is designed to be used with Node Cluster in production:\n* one log file for all workers\n* compatible with logrotate: an USR2 signal reopen the log file\n\nThis module is compatible with node 0.8.x. For the node 0.6.x, please use version 0.0.1 of this module.\n\nThis module is inspired from [this module](https://github.com/visionmedia/log.js).\n\n# How to use it\n\n## Installation\n\n npm install log4node\n\n## Usage\n\nDefault logger:\n```js\nvar log = require('log4node');\n\nlog.error(\"this is a log\");\n```\nWill output to console.\n\nNote: you can reconfigure default logger by calling\n\n log.reconfigure({level: 'info', file: 'toto.log'});\n\nWill now write into `toto.log`\n\nYour custom logger:\n```js\nvar log4node = require('log4node');\n log = new log4node.Log4Node({level: 'warning', file: 'test.log'});\n\nlog.error(\"this is a log\");\nlog.debug(\"this is a debug log\");\n```\n\nNote : you can use the syntax accepted by [`utils.format`](http://nodejs.org/api/util.html#util_util_format_format).\n\n## Log level\n\nLog level can be adjusted for each logger:\n\n log.setLogLevel('info');\n\nLog level for default logger is 'info'.\n\nAvailable log levels are:\n\n* emergency\n* alert\n* critical\n* error\n* warning\n* notice\n* info\n* debug\n\n## Prefix\n\nPrefix of log lines can be changed:\n\n```js\nlog.setPrefix(\"%d - %p \");\n```\n\nYou can use following field in prefix:\n* `%d`: current date\n* `%p`: current process id\n* `%l`: log level\n\nDefault prefix is: `[%d] %l `\n\n## Cluster mode\n\nWorkers processes will send logs to the cluster master for writing to file.\n\nSetup is fully transparent for developper.\n\nA full example can be found [here](https://github.com/bpaquet/log4node/blob/master/test/cluster/test1.js).\n\n## Reopen log file\n\nJust send USR2 signal to node process, or, in cluster mode, to master node process:\n\n kill -USR2 pid\n\nExample of logrotate file:\n\n /var/log/node.log {\n rotate 5\n weekly\n postrotate\n kill -USR2 `cat process.pid`\n endscript\n }\n\n## Create a specialized logger\nThis feature is provided to specialize a logger for a sub-component.\nYou can create a new logger with its own level and prefix for a sub-component.\nThe logs will be send to the same files with a prefix.\n\n```js\nlog = new log4node.Log4Node('warning', 'test.log');\nsublogger1 = log.clone({prefix:'SUBMODULE - ', level:'error');\n```\n\nor with the default logger\n\n```js\nsublogger1 = log4node.clone(prefix:'SUBMODULE - ', level:'error');\n```\n\n# License\n\nCopyright 2012 Bertrand Paquet\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n",
|
|
"readmeFilename": "Readme.markdown",
|
|
"_id": "log4node@0.1.2",
|
|
"dist": {
|
|
"shasum": "5648004b539af4738cd96c868eaa1f127d874819"
|
|
},
|
|
"_from": "log4node@",
|
|
"_resolved": "https://registry.npmjs.org/log4node/-/log4node-0.1.2.tgz"
|
|
}
|