UNPKG

btrz-health-check

Version:

A series of classes that will ping different service types to verify accessibility.

23 lines (18 loc) 521 B
"use strict"; function serviceStatus(name, status) { return {name: name, status: status}; } class ServiceStatus { constructor(defaultName, options) { this.name = options && options.name ? options.name : defaultName; this.logger = options && options.logger ? options.logger : {error: function () {}}; } success() { return serviceStatus(this.name, 200); } fails(err) { this.logger.error(this.name, err); return serviceStatus(this.name, 500); } } exports.ServiceStatus = ServiceStatus;