Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

cf-service-metrics-logger

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cf-service-metrics-logger

Log Cloud Foundry service metrics

  • 0.1.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

Cloud Foundry Service Metrics Logger

dependency travis appveyor coveralls


divider

❯ Table of Contents

divider

❯ Quick Start

Installation

Install library by using npm

npm install cf-service-metrics-logger

or by using yarn

yarn add cf-service-metrics-logger

How to use

Create a new instance of CfServiceMetricsLogger and pass any kind of logger implementing following interface:

  • debug(message: {} | [] | string | number)
  • info(message: {} | [] | string | number)
  • warn(message: {} | [] | string | number)
  • error(message: {} | [] | string | number)
/* import library by using CommonJS module loader */
const CfServiceMetricsLogger = require('cf-service-metrics-logger');

/* or import library by using ES6 module loader */
import { CfServiceMetricsLogger } from 'cf-service-metrics-logger';

/* create logger instance or use a logger library */
class Logger {
  debug(message) {
    console.debug(message);
  }

  info(message) {
    console.info(message);
  }

  warn(message) {
    console.warn(message);
  }

  error(message) {
    console.error(message);
  }
}

const logger = new Logger();

/* you can add some options to CfServiceMetricsLogger */
const options = {
  mongoDB: {
    serverStatusInterval: 10000, //optional
    bStatsInterval: 20000, //optional
  },
  redis: {
    infoInterval: 100000 //optional
  },
  vcap: {}; //optional
  vcapFile: ''; //optional
};

/* create new instance of CfServiceMetricsLogger and pass logger instance and optional options */
const cfServiceMetricsLogger = new CfServiceMetricsLogger(logger, options);

/* start service metrics logging */
cfServiceMetricsLogger.start();

/* stop service metrics logging */
cfServiceMetricsLogger.stop();

divider

❯ Development

Getting Started

Step 1: Set up the Development Environment

You need to set up your development environment before you can do anything.

Install Node.js and NPM

Install yarn globally

yarn install yarn -g
Step 2: Set up Environment Variables

Copy the vcap.example.json file and rename it to vcap.json. This file provides VCAP_SERVICES and/or VCAP_APPLICATION for local development. More information is provided here.

Step 3: Install dependencies

Install all dependencies with yarn.

yarn install

Scripts and Tasks

Install
  • Install all dependencies with yarn install
Linting
  • Run code quality analysis using yarn run lint. This runs tslint.
Tests
  • Run unit test using yarn run test.
Building the project
  • Run yarn run build to generate commonJS and ES6 modules as well as declaration from the TypeScript source.
  • Builded sources are located in dist folder.

Debugger

VS Code

Just set a breakpoint in source or unit test and hit F5 in your Visual Studio Code to execute and debug all unit tests.

divider

❯ Project Structure

NameDescription
.vscode/VSCode tasks, launch configuration and some other settings
dist/Compiled and bundled source files will be placed here
src/Source files
src/types/ *.d.tsCustom type definitions and files that aren't on DefinitelyTyped
test/Tests
test/unit/ *.test.tsUnit tests
vcap.example.jsonProvides VCAP_SERVICES and/or VCAP_APPLICATION for local development
vcap.test.jsonProvides VCAP_SERVICES and/or VCAP_APPLICATION for unit tests
rollup.config.jsConfig for Rollup module bundler

Keywords

FAQs

Package last updated on 29 Jan 2019

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc