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 process monitor. It listens for events emitted by Hapi Server instances and allows custom reporters to be registered that output subscribed events.
For example:
var Hapi = require('hapi');
var server = new Hapi.Server();
server.connection({ host: 'localhost' });
var options = {
opsInterval: 1000,
filter:{
access_token: 'censor'
},
reporters: [{
reporter: require('good-console'),
events: { log: '*', response: '*' }
}, {
reporter: require('good-file'),
events: { ops: '*' },
config: './test/fixtures/awesome_log'
}, {
reporter: 'good-http',
events: { error: '*' },
config: {
endpoint: 'http://prod.logs:3000',
wreck: {
headers: { 'x-api-key' : 12345 }
}
}
}]
};
server.register({
register: require('good'),
options: options
}, function (err) {
if (err) {
console.error(err);
}
else {
server.start(function () {
console.info('Server started at ' + server.info.uri);
});
}
});
This example does the following:
GoodConsole
reporter listening for 'response' and 'log' events.GoodFile
reporter to listen for 'ops' events and log them to ./test/fixtures/awesome_log
according to the file rules listed in the good-file documentation.GoodHttp
reporter to listen for error events and POSTs them to http://prod.logs:3000
with additional settings to pass 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.
Log messages are created with tags. Usually a log will include a tag to indicate if it is related to an error or info along with where the message originates. If, for example, the console should only output error's that were logged you can use the following configuration:
var options = {
reporters: [{
reporter: require('good-console'),
events: { log: ['error', 'medium'] }
}]
};
This will now only log 'log' events that have the 'error' or 'medium' tag attached to them. Any 'log' events without one of those tags will be ignored.
This is a list of good-reporters under the hapijs umbrella:
Here are some additional reporters that are available from the hapijs community:
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.