@code-nl/cloud-logging

2.0.0 • Public • Published

Cloud logging

This cloud logging package is an interface for @google-cloud/logging.

Once initialized, you might use it as simple as: log.info("order processed", {orderId: "1209235823"});.

The first argument is the message, the second argument is an object to create log labels with. Those labels are very helpfull in order to filter you log messages afterwards. You'd better use them!

Install

npm i @code-nl/cloud-logging --save

Usage

In order to make use of the cloud logging, you need to initialize the logger.

It takes 2 arguments:

  1. Google Cloud project id
  2. Log name which is the grouper
const log = require("@code-nl/cloud-logging");

// initialize with:
//   project id: "my-gcp-project-id"
//   log name: "some-log-name"
log.init("my-gcp-project-id", "some-log-name");

// create a log message with severity "info"
log.info("My log message with useful context", {id: "1234", test: "ABC"});

Package Sidebar

Install

npm i @code-nl/cloud-logging

Weekly Downloads

0

Version

2.0.0

License

MIT

Unpacked Size

7.79 kB

Total Files

4

Last publish

Collaborators

  • code-nl-account