Product
Introducing License Enforcement in Socket
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
hapi process monitoring
Lead Maintainer: Adam Bretz
good is a hapi plugin to monitor and report on a variety of hapi server events as well as ops information from the host machine. It listens for events emitted by hapi server instances and pushes standardized events to a collection of streams.
const Hapi = require('hapi');
const server = new Hapi.Server();
server.connection();
const options = {
ops: {
interval: 1000
},
reporters: {
console: [{
module: 'good-squeeze',
name: 'Squeeze',
args: [{ log: '*', response: '*' }]
}, {
module: 'good-console'
}, 'stdout'],
file: [{
module: 'good-squeeze',
name: 'Squeeze',
args: [{ ops: '*' }]
}, {
module: 'good-squeeze',
name: 'SafeJson'
}, {
module: 'good-file',
args: ['./test/fixtures/awesome_log']
}],
http: [{
module: 'good-squeeze',
name: 'Squeeze',
args: [{ error: '*' }]
}, {
module: 'good-http',
args: ['http://prod.logs:3000', {
wreck: {
headers: { 'x-api-key': 12345 }
}
}]
}]
}
};
server.register({
register: require('good'),
options: options
}, (err) => {
if (err) {
console.error(err);
} else {
server.start(() => {
console.info('Server started at ' + server.info.uri);
});
}
});
This example does the following:
console
reporter reporter listening for 'response' and 'log' events and writes them to process.stdout
.file
reporter to listen for 'ops' events and logs them to ./test/fixtures/awesome_log
.http
reporter to listen for error events and POSTs them to http://prod.logs:3000
with additional settings to passed into Wreck
NOTE: Ensure calling server.connection
prior to registering Good
. request
and response
event listeners are only registered on connections that exist on server
at the time Good
is registered.
Looking for more examples? Check out the examples folder.
The following streams are maintained by the hapi community and are known to work with good. Any transform or write stream can work with good, these are just a few inside the hapijs organization.
See the API Reference.
FAQs
Server and process monitoring plugin
The npm package good receives a total of 5,471 weekly downloads. As such, good popularity was classified as popular.
We found that good demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 6 open source maintainers 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.
Product
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
Product
We're launching a new set of license analysis and compliance features for analyzing, managing, and complying with licenses across a range of supported languages and ecosystems.
Product
We're excited to introduce Socket Optimize, a powerful CLI command to secure open source dependencies with tested, optimized package overrides.