
Security News
OpenClaw Skill Marketplace Emerges as Active Malware Vector
Security researchers report widespread abuse of OpenClaw skills to deliver info-stealing malware, exposing a new supply chain risk as agent ecosystems scale.
Yet another logger for Node.
Nothing fancy - logs all data that passes through process.stdout (console.log) and process.stderr (console.error).
consoleprocess.stdout and process.stderr producing two log levels:
LOGERRnpm install logbook
Disable console and log stdout stderr to log.txt and err.txt with timestamps:
require('logbook').configure({
console: {
enabled: false
},
file: {
enabled: true
}
});
Disable console and send stdout stderr to Loggly (200MB/day free):
require('logbook').configure({
console: {
enabled: false
},
loggly: {
enabled: false,
customerToken: "abcd1234-1234-40bd-bddf-5ff562eb1cda",
tags: ["my-app"]
}
});
Disable console and send stderr to everyone in your contact list:
require('logbook').configure({
console: {
enabled: false
},
xmpp: {
enabled: true,
jid: '...@gmail.com',
password: '...',
}
});
To prevent too much spam, only stderr is logged by default.
This can changed with xmpp.log: true.
require('logbook').configure({
console: {
enabled: false
},
smtp: {
enabled: true,
username: '...@gmail.com',
password: '...',
to: ["john@smith.com", "jane@doe.com"]
}
});
Again, only stderr is logged by default.
require('logbook').configure({
console: {
enabled: true
},
file: {
enabled: true,
...
},
loggly: {
enabled: true,
...
},
xmpp: {
enabled: true,
...
}
});
See examples directory for more
With this default configuration, logbook will have no effect, console will function as expected.
<runFile('./show-defaults')>
{
"console": {
"enabled": true,
"timestamps": false,
"typestamps": false,
"log": true,
"err": true
},
"file": {
"enabled": false,
"timestamps": true,
"typestamps": false,
"log": "./log.txt",
"err": "./err.txt"
},
"loggly": {
"enabled": false,
"customerToken": null,
"maxSockets": 10,
"tags": null,
"meta": null,
"log": true,
"err": true
},
"xmpp": {
"enabled": false,
"jid": null,
"password": null,
"host": "talk.google.com",
"port": 5222,
"to": "*",
"prefix": null,
"machineName": false,
"delay": 100,
"log": false,
"err": true
}
}
Add custom log handlers with add()
require('logbook').configure({
...
}).add(function(type, buffer) {
type === 'log' || type === 'err'; //true
buffer instanceof Buffer; //true
});
Configure loggers with configure()
All loggers have two options:
log (Boolean)Enable or disable log events
err (Boolean)Enable or disable error events
See defaults
See defaults
Important: Uses Loggly Gen2
Each log will be in the form
{
type: "log|err",
msg: "...",
date: unix-epoch,
tags: ["...", "...", "log|err"]
}
Note: tags and meta may contain functions. These functions will be evalutated once for each
log event. The result value must be stringifiable otherwise it will be discarded.
customerToken (String)The token provided by loggly which identifies your account.
tags (Array)The tags applied each log event. See Tags.
The log type (logbook-log|logbook-err) will always be appended to the tags array. Tip: Since there are no longer input tokens, differentiate application logs with tags. Add a 'my-app' tag and you can search for all of it's errors with tag:logbook-err AND tag:my-app.
meta (Object)An object that will be merged into the object above. Will not override existing values.
maxSockets (Number)The number of http agents to use when connecting to Loggly. Can be thought of as amount of concurrency, so beware of hitting Loggly too much as you may be seen as DOS attack. Hence, default is only 10.
See defaults
toAn array of jid Jabber IDs (Google Accounts in the case of Google Talk).
By default it's the string "*", which means everyone in the given
accounts contact list. Useful if you create
a logbook Jabber account, then you can "subscribe" to it at will.
delayThis is the delay (in milliseconds) before all acculated messages concatenated and sent. This helps to prevent performance loss.
prefixThis string will be prefixed to every message
See defaults
All properties not in the defaults will be used to create the SMTP options object which will be passed into createTransport("SMTP", options).
username passwordShorthand for auth: { user: username, pass: password }. See SMTP options object.
to requiredAn array of email addresses
delaySame as XMPP
This module simply assigns a new functions to process.stdout|err.write. Captures
all calls to it, calls the original versions when console.enabled true.
logbook.json file
logbook script.js logs all stdout stderr<license()>
Copyright © 2013 Jaime Pillora <dev@jpillora.com>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
FAQs
Log all data passing through process.stdout and process.stderr
The npm package logbook receives a total of 13 weekly downloads. As such, logbook popularity was classified as not popular.
We found that logbook demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Security researchers report widespread abuse of OpenClaw skills to deliver info-stealing malware, exposing a new supply chain risk as agent ecosystems scale.

Security News
Claude Opus 4.6 has uncovered more than 500 open source vulnerabilities, raising new considerations for disclosure, triage, and patching at scale.

Research
/Security News
Malicious dYdX client packages were published to npm and PyPI after a maintainer compromise, enabling wallet credential theft and remote code execution.