nodejs-logging/samples at main · googleapis/nodejs-logging

Google Cloud Platform logo

Cloud Logging: Node.js Samples

Open in Cloud Shell

Google Cloud Logging allows you to store, search, analyze, monitor, and alert on log data and events from Google Cloud Platform and Amazon Web Services.

If you require lightweight dependencies, an experimental, minified version of this library is available at @google-cloud/logging-min. Note: logging-min is experimental, and its feature surface is subject to change. To install @google-cloud/logging-min library run the following command:

npm install @google-cloud/logging-min

For an interactive tutorial on using the client library in a Node.js application, click Guide Me:

Guide Me

Table of Contents

Before you begin

Before running the samples, make sure you've followed the steps outlined in Using the client library.

cd samples

npm install

cd ..

Fluent

View the source code.

Open in Cloud Shell

Usage:

node samples/fluent.js


Log HTTP Request

Log a message with httpRequest metadata.

View the source code.

Open in Cloud Shell

Usage:

node http-request my-project-id


Logs

View the source code.

Open in Cloud Shell

Usage:

node samples/logs.js


Quickstart

View the source code.

Open in Cloud Shell

Usage:

node samples/quickstart.js


Sinks

View the source code.

Open in Cloud Shell

Usage:

node samples/sinks.js