Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@google-cloud/logging

googleapis5.4mApache-2.011.2.0TypeScript support: included

Cloud Logging Client Library for Node.js

google apis client, google api client, google apis, google api, google, google cloud platform, google cloud, cloud, google logging, logging, stackdriver logging, stackdriver

readme

Google Cloud Platform logo

Cloud Logging: Node.js Client

release level npm version

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

A comprehensive list of changes in each version may be found in the CHANGELOG.

Read more about the client libraries for Cloud APIs, including the older Google APIs Client Libraries, in Client Libraries Explained.

Table of contents:

Quickstart

Before you begin

  1. Select or create a Cloud Platform project.
  2. Enable the Cloud Logging API.
  3. Set up authentication with a service account so you can access the API from your local workstation.

Installing the client library

npm install @google-cloud/logging

Using the client library

// Imports the Google Cloud client library
const {Logging} = require('@google-cloud/logging');

async function quickstart(
  projectId = 'YOUR_PROJECT_ID', // Your Google Cloud Platform project ID
  logName = 'my-log' // The name of the log to write to
) {
  // Creates a client
  const logging = new Logging({projectId});

  // Selects the log to write to
  const log = logging.log(logName);

  // The data to write to the log
  const text = 'Hello, world!';

  // The metadata associated with the entry
  const metadata = {
    resource: {type: 'global'},
    // See: https://cloud.google.com/logging/docs/reference/v2/rest/v2/LogEntry#logseverity
    severity: 'INFO',
  };

  // Prepares a log entry
  const entry = log.entry(metadata, text);

  async function writeLog() {
    // Writes the log entry
    await log.write(entry);
    console.log(`Logged: ${text}`);
  }
  writeLog();
}

Batching Writes

High throughput applications should avoid awaiting calls to the logger:

await log.write(logEntry1);
await log.write(logEntry2);

Rather, applications should use a fire and forget approach:

log.write(logEntry1);
log.write(logEntry2);

The @google-cloud/logging library will handle batching and dispatching these log lines to the API.

Writing to Stdout

The LogSync class helps users easily write context-rich structured logs to stdout or any custom transport. It extracts additional log properties like trace context from HTTP headers and can be used as an on/off toggle between writing to the API or to stdout during local development.

Logs written to stdout are then picked up, out-of-process, by a Logging agent in the respective GCP environment. Logging agents can add more properties to each entry before streaming it to the Logging API.

Read more about Logging agents.

Serverless applications like Cloud Functions, Cloud Run, and App Engine are highly recommended to use the LogSync class as async logs may be dropped due to lack of CPU.

Read more about structured logging.

// Optional: Create and configure a client
const logging = new Logging();
await logging.setProjectId()
await logging.setDetectedResource()

// Create a LogSync transport, defaulting to `process.stdout`
const log = logging.logSync(logname);
const meta = { // optional field overrides here };
const entry = log.entry(meta, 'Your log message');
log.write(entry);

// Syntax sugar for logging at a specific severity
log.alert(entry);
log.warning(entry);

Populating Http request metadata

Metadata about Http request is a part of the structured log info that can be captured within each log entry. It can provide a context for the application logs and is used to group multiple log entries under the load balancer request logs. See the sample how to populate the Http request metadata for log entries.

If you already have a "raw" Http request object you can assign it to entry.metadata.httpRequest directly. More information about how the request is interpreted as raw can be found in the code.

Automatic Trace/Span ID Extraction

Cloud Logging libraries use trace fields within LogEntry to capture trace contexts, which enables the correlation of logs and traces, and distributed tracing troubleshooting. These tracing fields, including trace, spanId, and traceSampled, define the trace context for a LogEntry.

If not provided explicitly in a LogEntry, the Cloud Logging library automatically populates trace, span_id, and trace_sampled fields from detected OpenTelemetry span contexts, or from HTTP request headers.

Extracting Trace/Span ID from OpenTelemetry Context

If you are using OpenTelemetry and there is an active span in the OpenTelemetry Context, the trace, span_id, and trace_sampled fields in the log entry are automatically populated from the active span. More information about OpenTelemetry can be found here.

Extracting Trace/Span ID from HTTP Headers

If tracing fields are not provided explicitly and no OpenTelemetry context is detected, the trace / span_id fields are extracted automatically from HTTP headers. Trace information can be automatically populated from either the W3C Traceparent or X-Cloud-Trace-Context headers.

Error handling with logs written or deleted asynchronously

The Log class provide users the ability to write and delete logs asynchronously. However, there are cases when log entries cannot be written or deleted and error is thrown - if error is not handled properly, it could crash the application. One possible way to catch the error is to await the log write/delete calls and wrap it with try/catch like in example below:

    // Write log entry and and catch any errors
    try {
      await log.write(entry);
    } catch (err) {
      console.log('Error is: ' + err);
    }

However, awaiting for every log.write or log.delete calls may introduce delays which could be avoided by simply adding a callback like in the example below. This way the log entry can be queued for processing and code execution will continue without further delays. The callback will be called once the operation is complete:

    // Asynchronously write the log entry and handle respone or any errors in provided callback
    log.write(entry, err => {
      if (err) {
        // The log entry was not written.
        console.log(err.message);
      } else {
        console.log('No error in write callback!');
      }
    });

Adding a callback to every log.write or log.delete calls could be a burden, especially if code handling the error is always the same. For this purpose we introduced an ability to provide a default callback for Log class which could be set through LogOptions passed to Log constructor as in example below - this way you can define a global callback once for all log.write and log.delete calls and be able to handle errors:

  const {Logging} = require('@google-cloud/logging');
  const logging = new Logging();

  // Create options with default callback to be called on every write/delete response or error
  const options = {
    defaultWriteDeleteCallback: function (err) {
      if (err) {
        console.log('Error is: ' + err);
      } else {
        console.log('No error, all is good!');
      }
    },
  };

  const log = logging.log('my-log', options);

See the full sample in writeLogWithCallback function here.

Samples

Samples are in the samples/ directory. Each sample's README.md has instructions for running its sample.

Sample Source Code Try it
Fluent source code Open in Cloud Shell
Log HTTP Request source code Open in Cloud Shell
Logs source code Open in Cloud Shell
Quickstart source code Open in Cloud Shell
Sinks source code Open in Cloud Shell

The Cloud Logging Node.js Client API Reference documentation also contains samples.

Supported Node.js Versions

Our client libraries follow the Node.js release schedule. Libraries are compatible with all current active and maintenance versions of Node.js. If you are using an end-of-life version of Node.js, we recommend that you update as soon as possible to an actively supported LTS version.

Google's client libraries support legacy versions of Node.js runtimes on a best-efforts basis with the following warnings:

  • Legacy versions are not tested in continuous integration.
  • Some security patches and features cannot be backported.
  • Dependencies cannot be kept up-to-date.

Client libraries targeting some end-of-life versions of Node.js are available, and can be installed through npm dist-tags. The dist-tags follow the naming convention legacy-(version). For example, npm install @google-cloud/logging@legacy-8 installs client libraries for versions compatible with Node.js 8.

Versioning

This library follows Semantic Versioning.

This library is considered to be stable. The code surface will not change in backwards-incompatible ways unless absolutely necessary (e.g. because of critical security issues) or with an extensive deprecation period. Issues and requests against stable libraries are addressed with the highest priority.

More Information: Google Cloud Platform Launch Stages

Contributing

Contributions welcome! See the Contributing Guide.

Please note that this README.md, the samples/README.md, and a variety of configuration files in this repository (including .nycrc and tsconfig.json) are generated from a central template. To edit one of these files, make an edit to its templates in directory.

License

Apache Version 2.0

See LICENSE

changelog

Changelog

npm history

11.2.0 (2024-07-15)

Features

  • Open telemetry integration and span Id fix for nodejs logging library (#1497) (91577e0)

11.1.0 (2024-05-29)

Features

  • Add several fields to manage state of database encryption update (#1495) (4137f7b)
  • Update Nodejs generator to send API versions in headers for GAPICs (#1502) (346e646)

Bug Fixes

  • Correct long audio synthesis HTTP binding (#1479) (1f94504)
  • Improve retry logic for streaming API calls (#1484) (7e11e11)

11.0.0 (2023-08-10)

⚠ BREAKING CHANGES

  • migrate to Node 14

Miscellaneous Chores

10.5.0 (2023-05-30)

Features

  • Log Analytics features of the Cloud Logging API (#1416) (3c3de6d)

10.4.1 (2023-04-28)

Bug Fixes

10.4.0 (2023-01-30)

Features

10.3.3 (2022-12-16)

Bug Fixes

  • Add CLOUDSDK_PYTHON env var to environment tests (#1385) (8ac3e6b)

10.3.2 (2022-12-02)

Bug Fixes

10.3.1 (2022-11-07)

Bug Fixes

  • Switch instrumentation code to work with NODEJS_DEFAULT_LIBRARY_VERSION only (#1373) (32b22b4)

10.3.0 (2022-11-04)

Features

  • Add support for instrumentation version annotations (#1370) (c039022)

10.2.3 (2022-11-03)

Bug Fixes

10.2.2 (2022-10-31)

Bug Fixes

  • Runtime package.json check causes breakage when bundled (#1364) (ec40231)

10.2.1 (2022-10-28)

Bug Fixes

  • Correct an order of instrumentation entries (#1362) (c6b11e3)

10.2.0 (2022-10-27)

Features

  • Add support for partialSuccess global configuration (#1359) (178b19f)

10.1.11 (2022-10-11)

Bug Fixes

10.1.10 (2022-09-14)

Bug Fixes

  • Preserve default values in x-goog-request-params header (#1337) (87c8d1f)

10.1.9 (2022-09-09)

Bug Fixes

10.1.8 (2022-09-03)

Bug Fixes

  • Correction for timestamp and instrumentation record severity fields format (#1328) (057431b)

10.1.7 (2022-09-02)

Bug Fixes

10.1.6 (2022-08-31)

Bug Fixes

  • use _gaxModule when accessing gax for bundling (#1322) (9cd207d)

10.1.5 (2022-08-27)

Bug Fixes

10.1.4 (2022-08-25)

Bug Fixes

10.1.3 (2022-08-23)

Bug Fixes

10.1.2 (2022-08-20)

Bug Fixes

  • better support for fallback mode (#1312) (91c1222)
  • Instrumentation version contains package.json content (#1310) (01e1286)
  • maxResults in getEntries looks broken (#1311) (208d994)

10.1.1 (2022-07-14)

Bug Fixes

  • Add LogSyncOptions parameter to Logging.logSync() API (#1307) (89408b0)

10.1.0 (2022-07-11)

Features

Bug Fixes

  • Change image in readme to a static link (#1306) (7f778db), closes #1303
  • Logging to stdout in Cloud Run creates a JSON object as "message" (#1305) (cb5f424)

10.0.4 (2022-06-12)

Bug Fixes

  • deps: update dependency @google-cloud/common to v4 (#1295) (15fb8b8)
  • deps: update dependency @google-cloud/projectify to v3 (#1296) (5e99ce1)

10.0.3 (2022-06-01)

Bug Fixes

  • fixes for dynamic routing and streaming descriptors (#1282) (fd0acfc)

10.0.2 (2022-05-25)

Bug Fixes

  • deps: update dependency @google-cloud/storage to v6 (#1283) (090a9fb)

10.0.1 (2022-05-20)

Bug Fixes

  • Add support to set an instrumentation flag (#1279) (6d470fc)
  • deps: update dependency @google-cloud/paginator to v4 (#1276) (0bfe813)

10.0.0 (2022-05-18)

⚠ BREAKING CHANGES

  • update library to use Node 12 (#1272)

Build System

9.9.0 (2022-05-09)

Features

9.8.3 (2022-04-14)

Bug Fixes

9.8.2 (2022-03-30)

Bug Fixes

9.8.1 (2022-03-29)

Bug Fixes

  • Add installation step for @google-cloud/logging-min NPM package in README (#1239) (f31e3ed)

9.8.0 (2022-02-26)

Features

9.7.0 (2022-02-18)

Features

  • Update Logging API with latest changes (5eddc7d)

9.6.9 (2022-02-09)

Bug Fixes

  • Regular error showing Total timeout of API google.logging.v2.LoggingServiceV2 exceeded 600000 milliseconds (#1225) (7f584bc)

9.6.8 (2022-01-21)

Bug Fixes

  • log.write removed option.resource.labels (#1219) (6d7e9ed)

9.6.7 (2022-01-11)

Bug Fixes

  • Setting maxEntrySize does not truncate big json payloads correctly (#1177) (ec66e4d)

9.6.6 (2021-12-22)

Bug Fixes

9.6.5 (2021-12-21)

Bug Fixes

9.6.4 (2021-12-13)

Bug Fixes

  • Correct a comment in sample regarding asynchronous log writing (#1189) (c4abb7e)

9.6.3 (2021-11-08)

Bug Fixes

9.6.2 (2021-11-01)

Bug Fixes

  • Cannot read property 'forEach' of undefined (#1173) (abf1ab0)

9.6.1 (2021-09-30)

Bug Fixes

9.6.0 (2021-09-08)

Features

Bug Fixes

9.5.7 (2021-09-02)

Bug Fixes

9.5.6 (2021-09-01)

Bug Fixes

9.5.5 (2021-08-16)

Bug Fixes

  • deps: require google-gax v2.24.1 (#1139) (4c9fc48)
  • Updating WORKSPACE files to use the newest version of the Typescript generator. (#1121) (8ac1348)

9.5.4 (2021-07-14)

Bug Fixes

9.5.3 (2021-07-12)

Bug Fixes

9.5.2 (2021-06-30)

Bug Fixes

9.5.1 (2021-06-23)

Bug Fixes

9.5.0 (2021-06-23)

Features

  • users can write structured logEntries to STDOUT (#1102) (f4e892e)

9.4.1 (2021-06-14)

Bug Fixes

9.4.0 (2021-06-11)

Features

  • detect Google and W3C trace context (including in middleware) (#1088) (864f188)
  • users can log raw http request objects with trace (#1086) (19b943e)

Bug Fixes

9.3.1 (2021-05-25)

Bug Fixes

  • GoogleAdsError missing using generator version after 1.3.0 (#1081) (bf0113d)

9.3.0 (2021-05-24)

Features

  • fix resource autodetection for GKE, GAE, and GCE (#1070) (1820f5d)

Bug Fixes

  • debrand Stackdriver & do not throw errors (#1073) (5cd8c17)
  • Object implementing toString not logged as Object (#1077) (a060957)
  • use require() to load JSON protos (#1065) (9718d9a)

9.2.3 (2021-05-07)

Bug Fixes

9.2.2 (2021-05-04)

Bug Fixes

9.2.1 (2021-04-15)

Bug Fixes

  • accept uniqueWriterIdentity in setMetadata (#1034) (02e8bb4)
  • cloud functions resource.labels.region undefined (#1028) (3808656)
  • deps: remove dependency on through2 (#1023) (485347f)

9.2.0 (2021-04-05)

Features

Bug Fixes

9.1.1 (2021-03-31)

Bug Fixes

  • Insufficient return values for GetEntriesResponse and GetLogsResponse (#1011) (0157ae1), closes #1010

9.1.0 (2021-03-03)

Features

Bug Fixes

  • deps: update dependency type-fest to ^0.21.0 (#997) (47a4c72)

9.0.2 (2021-02-09)

Bug Fixes

  • deps: update dependency google-auth-library to v7 (#993) (9edeaf7)

9.0.1 (2021-01-07)

Bug Fixes

9.0.0 (2020-12-04)

⚠ BREAKING CHANGES

  • getEntries filters 24 hour timestamp by default (#955)
  • users can log httprequest logs without providing a log message (#942)

Bug Fixes

  • only apply logName to filter when not already present (#962) (f1fbbc4)
  • deps: roll back dependency @google-cloud/logging to ^8.1.1 (#961) (1fa8cd3)
  • users can log httprequest logs without providing a log message (#942) (d72a296)

Performance Improvements

  • getEntries filters 24 hour timestamp by default (#955) (3d63d5f)

8.2.0 (2020-11-30)

Features

  • add the Tailing API to get a live stream of the tail end of filtered logs (#958) (c7b2801)
  • Makes remaining LogBucket and LogViews methods public (c9a69da)

Bug Fixes

  • deps: update dependency type-fest to ^0.20.0 (#956) (ed9dcf8)

8.1.1 (2020-11-16)

Bug Fixes

  • deps: update dependency type-fest to ^0.19.0 (#945) (bd5f001)

8.1.0 (2020-11-09)

Features

  • accept entry.timestamp string input in RFC3339 format (#937) (869bbaf)

Bug Fixes

  • deps: roll back dependency @google-cloud/logging to ^8.0.9 (#940) (2a3ad40)

8.0.10 (2020-11-06)

Bug Fixes

  • do not modify options object, use defaultScopes (#935) (fd1e63a)

8.0.9 (2020-11-03)

Bug Fixes

  • deps: update dependency dot-prop to v6 (#908) (e696466)
  • deps: update dependency type-fest to ^0.18.0 (#912) (dafdf8e)

8.0.8 (2020-10-06)

Bug Fixes

8.0.7 (2020-10-05)

Bug Fixes

  • deps: update dependency @google-cloud/common to v3 (#892) (b7c0f96)
  • deps: update dependency @google-cloud/projectify to v2 (#895) (884e905)
  • deps: update dependency gcp-metadata to v4 (#893) (ce79a7c)
  • deps: update dependency google-auth-library to v6 (#894) (d2bbe3c)
  • deps: update dependency type-fest to ^0.17.0 (#901) (860b795)

8.0.6 (2020-09-12)

Bug Fixes

  • deps: update dependency yargs to v16 (#889) (08ee746)

8.0.5 (2020-08-18)

Bug Fixes

8.0.4 (2020-08-14)

Bug Fixes

8.0.3 (2020-08-10)

Bug Fixes

  • deps: roll back dependency @google-cloud/logging to ^8.0.1 (#867) (3bd950a)

8.0.2 (2020-08-06)

Bug Fixes

8.0.1 (2020-07-06)

Bug Fixes

  • deps: update dependency through2 to v4 (#838) (9c9c302)
  • deps: update dependency type-fest to ^0.16.0 (#840) (1db672d)

8.0.0 (2020-06-12)

⚠ BREAKING CHANGES

  • The library now supports Node.js v10+. The last version to support Node.js v8 is tagged legacy-8 on NPM.
  • move API to Typescript generation (#758)
  • proto annotations

Features

Bug Fixes

  • explicit export of protobuf.roots (#781) (12808be)
  • handle fallback option properly (#832) (6355b20)
  • linting and formatting (#809) (739cc3a)
  • proto annotations (e31cc01)
  • remove eslint, update gax, fix generated protos, run the generator (#789) (d1df1bd)
  • deps: update dependency @google-cloud/paginator to v3 (#766) (58fe7b0)
  • deps: update dependency @google-cloud/promisify to v2 (#763) (d3fd09d)
  • deps: update dependency @google-cloud/storage to v5 (#812) (b1be6c4)
  • deps: update dependency @opencensus/propagation-stackdriver to v0.0.21 (#771) (958d186)
  • deps: update dependency @opencensus/propagation-stackdriver to v0.0.22 (#822) (6f1d18e)
  • deps: update dependency type-fest to ^0.13.0 (#782) (13dcb78)
  • deps: update dependency type-fest to ^0.15.0 (#814) (2fc7eed)
  • sample-test: we shouldn't delete node_modules after link (aa4850b)

7.3.0 (2020-03-11)

Features

  • export protos in src/index.ts (0dbbe35)

Bug Fixes

  • deps: update dependency type-fest to ^0.12.0 (#741) (c011c7d)
  • docs: documentation for overloaded methods (#725) (06a2cea), closes #723

7.2.3 (2020-02-26)

Bug Fixes

  • docs: writeLog should be in async function (498a2c3), closes #693

7.2.2 (2020-02-20)

Bug Fixes

  • deps: update dependency type-fest to ^0.11.0 (#718) (17decd4)

7.2.1 (2020-02-20)

Bug Fixes

  • deps: update dependency @opencensus/propagation-stackdriver to v0.0.20 (#714) (865b19f)

7.2.0 (2020-02-19)

Features

  • add CMEK config and update grpc config logic (#700) (a3fb0f3)
  • add getLogs() and getLogsStream() (#692) (d582eeb)

Bug Fixes

  • deps: update dependency type-fest to ^0.10.0 (#697) (395a31d)
  • use logging api resource for metric (#704) (0239b81)
  • docs: orderby samples and documentation (#713) (e703c23)
  • types: write options dryRun and partialSuccess (#711) (#712) (56a8ed8)

7.1.0 (2020-01-29)

Features

  • support uniqueWriterIdentity in Sink.create (#686) (41c0346)

Bug Fixes

  • enum, bytes, and Long types now accept strings (6605067)

7.0.1 (2020-01-24)

Bug Fixes

  • deps: update dependency type-fest to ^0.9.0 (#682) (e39c401)

7.0.0 (2020-01-09)

⚠ BREAKING CHANGES

  • if using GKE, "Kubernetes Container" type is now properly populated, and logs will be grouped accordingly.

Features

  • samples: increase logging client scope (#670) (5f35601)

Bug Fixes

  • populate k8s_container rather than container (#674) (fa32048)
  • docs: point folks towards the appropriate client instantiation (091d7dd)
  • types: extend constructor options from gax (#676) (5156538)

6.0.0 (2019-12-06)

⚠ BREAKING CHANGES

  • properly depend on Long in protos (#640)

Features

  • samples: add example of including httpRequest metadata in log (#650) (e6d293e)

Bug Fixes

  • properly depend on Long in protos (#640) (e22b695)
  • deps: TypeScript 3.7.0 causes breaking change in typings (#654) (432fe5d)
  • deps: update dependency @opencensus/propagation-stackdriver to v0.0.19 (#644) (3eaca43)
  • docs: snippets are now replaced in jsdoc comments (#634) (687fc81)

5.5.5 (2019-11-08)

Bug Fixes

  • deps: update dependency eventid to v1 (#628) (2128ef1)

5.5.4 (2019-10-25)

Bug Fixes

  • package: add missing dependency google-auth-library (#620) (5ef2377)

5.5.3 (2019-10-22)

Bug Fixes

  • deps: bump google-gax to 1.7.5 (#616) (5d73a06)
  • deps: update dependency @google-cloud/storage to v4 (#613) (4ec4f18)

5.5.2 (2019-10-17)

Bug Fixes

  • deps: update dependency @opencensus/propagation-stackdriver to v0.0.18 (#605) (0dac747)

5.5.1 (2019-10-17)

Bug Fixes

  • truncate additional fields set by winston/bunyan (#609) (27ac693)

5.5.0 (2019-10-16)

Features

  • introduce maxEntrySize, for enabling error message truncation (#607) (49efd49)

5.4.1 (2019-10-10)

Bug Fixes

5.4.0 (2019-10-09)

Bug Fixes

  • use compatible version of google-gax (7576ef2)
  • deps: gcp-metadata now handles ENETUNREACH (#600) (e3ed1d6)

Features

  • introduces startTime and endTime (4406446)

5.3.1 (2019-09-17)

Bug Fixes

  • deps: updates to metadata check to better work in all environments (#581) (24b97e4)

5.3.0 (2019-09-16)

Bug Fixes

  • deps: update dependency @opencensus/propagation-stackdriver to v0.0.17 (#569) (7077e64)
  • add missing function overload (#573) (8cd073b)
  • use correct version for x-goog-api-client header (#565) (7b60835)
  • use process versions object for client header (#563) (2ec8662)
  • deps: update dependency type-fest to ^0.8.0 (#578) (422a0ed)

Features

  • load protos from JSON, grpc-fallback support (#571) (41ef532)

5.2.2 (2019-08-20)

Bug Fixes

  • add test for x-goog-api-client header (#556) (f2cd5ea)
  • deps: update dependency yargs to v14 (bd8da51)

5.2.1 (2019-08-05)

Bug Fixes

  • deps: update dependency @google-cloud/paginator to v2 (#537) (ae14f59)
  • deps: update dependency google-auth-library to v5 (#539) (b8351a7)
  • allow calls with no request, add JSON proto (9313998)
  • deps: update dependency type-fest to ^0.7.0 (#554) (62362e6)
  • docs: add note about batching writes (#528) (25ba962)

5.2.0 (2019-07-17)

Features

  • add path template parsing for billing, organizations, and folders (#529) (1e8c67f)

5.1.3 (2019-06-26)

Bug Fixes

  • docs: link to reference docs section on googleapis.dev (#521) (971c1b6)

5.1.2 (2019-06-16)

Bug Fixes

5.1.1 (2019-06-14)

Bug Fixes

  • deps: update dependency @opencensus/propagation-stackdriver to v0.0.14 (#509) (3cba4dc)
  • deps: update dependency snakecase-keys to v3 (#510) (eb2193e)
  • docs: move to new client docs URL (#514) (9043cfa)

5.1.0 (2019-06-05)

Features

  • add .repo-metadata.json for docs generation (#502) (4a3b80a)
  • support apiEndpoint override (#501) (f701358)
  • support apiEndpoint override in client constructor (#505) (bda7124)

5.0.1 (2019-05-21)

Bug Fixes

  • deps: update dependency @opencensus/propagation-stackdriver to v0.0.13 (#489) (0f57adf)

5.0.0 (2019-05-17)

Bug Fixes

  • deps: update dependency @google-cloud/common-grpc to v1 (#479) (58e6154)
  • deps: update dependency @google-cloud/paginator to v1 (#467) (90d74bd)
  • deps: update dependency @google-cloud/projectify to v1 (#464) (f6ef399)
  • deps: update dependency @google-cloud/promisify to v1 (#465) (5871e4b)
  • deps: update dependency @opencensus/propagation-stackdriver to v0.0.12 (#483) (afe89de)
  • deps: update dependency gcp-metadata to v2 (#474) (125b356)
  • deps: update dependency google-auth-library to v4 (#475) (558bfc5)
  • deps: update dependency google-gax to ^0.26.0 (#459) (7417dcb)
  • deps: update dependency google-gax to v1 (#477) (535aedb)
  • DEADLINE_EXCEEDED no longer listed as idempotent (473d145)
  • deps: update dependency type-fest to ^0.4.0 (#455) (3c2324b)
  • deps: update dependency type-fest to ^0.5.0 (#482) (ee5d17f)
  • DEADLINE_EXCEEDED retry code is idempotent (#478) (4fdb8c1)
  • use originalUrl for Express middleware's request url (#476) (0ee71bd), closes #472

Build System

BREAKING CHANGES

  • upgrade engines field to >=8.10.0 (#461)

v4.5.2

04-11-2019 14:26 PDT

This release has minor bug fixes:

  • fix(types): improve types for LogEntry (#448)
  • fix: include 'x-goog-request-params' header in requests (#439)

v4.5.1

03-18-2019 19:32 PDT

Bug Fixes

  • fix(ts): do not require storage/pubsub types, add install test (#430)

v4.5.0

03-13-2019 22:25 PDT

New Features

  • feat: ability to detect service context (#400)

Bug Fixes

  • fix: do not push duplicate scopes (#414)
  • fix: throw on invalid credentials (#395)

Dependencies

  • fix(deps): update dependency @google-cloud/paginator to ^0.2.0 (#419)
  • fix(deps): update dependency gcp-metadata to v1 (#402)
  • fix(deps): update dependency @opencensus/propagation-stackdriver to v0.0.9 (#394)
  • fix(deps): update dependency @google-cloud/promisify to ^0.4.0 (#398)

Documentation

  • docs: update links in contrib guide (#399)

Internal / Testing Changes

  • chore(deps): update dependency @google-cloud/pubsub to ^0.28.0 (#421)
  • refactor: update json import paths (#422)
  • chore(deps): update dependency supertest to v4 (#420)
  • refactor: clean up types and imports (#409)
  • build: Add docuploader credentials to node publish jobs (#415)
  • build: use node10 to run samples-test, system-test etc (#413)
  • build: update release configuration
  • chore(deps): update @google-cloud/pubsub to v0.27.0 (#410)
  • chore(deps): update dependency @google-cloud/pubsub to ^0.26.0 (#407)
  • refactor (typescript): noImplilcitAny (#408)
  • chore(deps): update dependency @google-cloud/pubsub to ^0.25.0 (#405)
  • chore: update proto docs and code style
  • chore(deps): update dependency mocha to v6 (#403)
  • build: use linkinator for docs test (#397)
  • refactor: expose and improve types (#393)
  • fix(deps): update dependency yargs to v13 (#392)
  • chore: use proper enum for GCPEnv (#389)

v4.4.0

02-11-2019 17:40 PST

New Features

  • feat: include TypeScript types (#387)

Bug Fixes

  • fix: stop exporting express types publicly (#376)

Documentation

  • docs: update contributing path in README (#383)
  • chore: move CONTRIBUTING.md to root (#382)
  • docs: add lint/fix example to contributing guide (#379)
  • docs: fix example comments (#378)

Internal / Testing Changes

  • build: create docs test npm scripts (#385)
  • build: test using @grpc/grpc-js in CI (#384)
  • refactor: improve generated code style. (#377)

v4.3.0

01-31-2019 12:49 PST

Implementation Changes

  • Modify retry settings for WriteLogEntries, update year in the license headers (#366)

Dependencies

  • fix(deps): update dependency google-gax to ^0.25.0 (#373)
  • chore(deps): update dependency @google-cloud/pubsub to ^0.24.0 (#371)
  • fix(deps): update dependency @google-cloud/common-grpc to ^0.10.0 (#372)
  • chore(deps): update dependency eslint-config-prettier to v4 (#370)
  • fix(deps): update dependency google-gax to ^0.24.0 (#369)
  • chore(deps): update dependency @google-cloud/pubsub to ^0.23.0 (#367)
  • fix(deps): update dependency google-auth-library to v3 (#365)
  • fix(deps): update dependency google-gax to ^0.23.0 (#364)

Documentation

  • build: ignore googleapis.com in doc link check (#368)
  • fix(docs): removed unused gRPC message types

Internal / Testing Changes

  • build: check broken links in generated docs (#358)

v4.2.0

01-02-2019 12:43 PST

New Features

  • feat: cache detected environment's default resource (#359)

Dependencies

  • fix(deps): update dependency @opencensus/propagation-stackdriver to v0.0.8 (#354)

Internal / Testing Changes

  • refactor: modernize the sample tests (#356)
  • refactor(ts): improve typescript types (#309)
  • chore(build): inject yoshi automation key (#352)
  • chore: update nyc and eslint configs (#351)
  • chore: fix publish.sh permission +x (#348)
  • fix(build): fix Kokoro release script (#347)
  • build: add Kokoro configs for autorelease (#346)
  • chore: always nyc report before calling codecov (#342)
  • chore: nyc ignore build/test by default (#341)

v4.1.1

12-05-2018 13:12 PST

Implementation Changes

TypeScript related changes:

  • refactor(ts): generate logging types from proto (#314)
  • refactor(ts): use es imports and exports (#307)

Dependencies

  • chore(deps): update dependency typescript to ~3.2.0 (#331)
  • chore(deps): update dependency @google-cloud/pubsub to ^0.22.0 (#333)
  • fix(deps): update dependency google-gax to ^0.22.0 (#323)
  • fix(deps): update dependency @opencensus/propagation-stackdriver to v0.0.7 (#322)
  • chore(deps): update dependency @google-cloud/pubsub to ^0.21.0 (#324)
  • chore(deps): update dependency gts to ^0.9.0 (#321)
  • chore(deps): update dependency bignumber.js to v8 (#301)
  • chore(deps): update dependency @types/is to v0.0.21 (#315)
  • chore(deps): update dependency @google-cloud/nodejs-repo-tools to v3 (#318)
  • fix(deps): update dependency through2 to v3 (#311)

Documentation

  • docs(samples): updated samples code to use async await (#329)
  • docs: update directory for docs generation (#312)

Internal / Testing Changes

  • fix(docs): const logging = require.. contains binary (#338)
  • chore: update license file (#337)
  • docs: update readme badges (#335)
  • fix(build): fix system key decryption (#332)
  • chore: add synth.metadata
  • chore: update eslintignore config (#320)
  • chore: drop contributors from multiple places (#316)
  • chore: use latest npm on Windows (#313)
  • chore(build): use the latest npm on windows for tests (#304)
  • refactor: go back to prettier, use generated gapic tests (#308)

v4.1.0

New Features

  • feat: export middleware helpers (#289)
  • feat: Introduce middleware directory (#248)

Bug fixes

  • fix(metadata): include zone on GAE descriptor (#298)
  • fix(middleware): tweak the middleware api (#291)
  • fix: resolve compile errors (#287)
  • fix(deps): move nock to devDependencies (#276)

Dependencies

  • fix(deps): update dependency @opencensus/propagation-stackdriver to v0.0.6 (#283)
  • chore(deps): update dependency eslint-plugin-node to v8 (#284)
  • fix(deps): update dependency gcp-metadata to ^0.9.0 (#279)
  • fix(deps): update dependency snakecase-keys to v2 (#259)
  • refactor: remove async, methmeth, propprop (#253)
  • fix(deps): update dependency google-proto-files to ^0.17.0 (#242)
  • chore(deps): update dependency sinon to v7 (#243)
  • chore(deps): update dependency eslint-plugin-prettier to v3 (#238)
  • chore(deps): update dependency @google-cloud/pubsub to v0.20.1 (#236)
  • fix(samples): update dependency @google-cloud/logging-winston to ^0.10.0 (#235)

Documentation

  • docs: update reference documentation

Internal / Testing Changes

  • chore: update CircleCI config (#302)
  • chore: remove a few unused deps (#299)
  • fix: fix system tests by choosing semver range for BigQuery (#297)
  • fix: disable skipLibCheck in the tsconfig (#296)
  • refactor(metadata): use async/await (#295)
  • chore: include build in eslintignore (#292)
  • fix(tsconfig): disable allowJs, enable declaration (#288)
  • refactor(ts): convert tests to typescript (#282)
  • test: fix the system tests with cleanup (#281)
  • fix(fix): no fix for samples/node_modules (#278)
  • chore: update github issue templates (#274)
  • chore: remove old issue template (#270)
  • build: run tests on node11 (#268)
  • chore(typescript): convert src/ to typescript (#258)
  • fix(synth): s.replace import syntax of code samples in autogenerated code (#266)
  • chore: use gts for samples; jettison prettier (#255)
  • chores(build): do not collect sponge.xml from windows builds (#257)
  • chores(build): run codecov on continuous builds (#256)
  • chore: run gts fix (#252)
  • refactor: introduce typescript compiler (#246)
  • fix(test): block auth during public system tests (#249)
  • build: fix codecov uploading on Kokoro (#244)
  • test: remove appveyor config (#234)

v4.0.1

Implementation Changes

  • fix(deps): Upgrade to @google-cloud/common-grpc 0.9.0 (#232)

v4.0.0

This release has breaking changes. This library is now compatible with es module import syntax.

Old Code

const logging = require('@google-cloud/logging')();
// or...
const Logging = require('@google-cloud/logging');
const logging = new Logging();

New Code

const {Logging} = require('@google-cloud/logging');
const logging = new Logging();

Breaking changes

  • Use es classes (#219)

Bug Fixes

  • fix(gce): instance id can be a big number (#222)
  • fix(deps): update dependency @google-cloud/storage to v2 (#213)
  • fix(GCE): add zone label in GCE descriptor (#215)
  • fix(deps): update dependency google-auth-library to v2 (#210)

Internal / Testing Changes

  • build: write logs to separate file (#230)
  • Enable prefer-const in the eslint config (#229)
  • fix(deps): roll back dependency @google-cloud/logging to ^3.0.2 (#224)
  • Enable no-var in eslint (#228)
  • Use arrow functions (#227)
  • Switch to let/const (#221)
  • fix(deps): update dependency google-gax to ^0.20.0 (#220)
  • Use let and const (#217)
  • Update CI config (#218)
  • Retry npm install in CI (#214)
  • add templates to synth.py and run it (#211)

v3.0.2

This release contains a variety of minor internal changes.

Internal / Testing Changes

  • chore: upgrade to the latest common-grpc (#203)
  • Re-generate library using /synth.py (#202)
  • chore(deps): update dependency nyc to v13 (#200)
  • chore(deps): update samples dependency @google-cloud/logging-bunyan to ^0.9.0 (#199)
  • fix(deps): update dependency google-gax to ^0.19.0 (#198)
  • chore: use mocha for sample tests (#197)

v3.0.1

Fixes

  • fix(deps): update dependency @google-cloud/logging to v3 (#195)
  • fix(gke): correctly detect kubernetes engine (#193)

v3.0.0

This should not have been a semver major release. There are no breaking changes.

Bug fixes

  • fix(gke): include namespace_id in resource (#191)
  • fix: drop support for node.js 4.x and 9.x (#161)
  • Re-generate library using /synth.py (#154)

Keepin' the lights on

  • chore(deps): update dependency eslint-config-prettier to v3 (#190)
  • chore: do not use npm ci (#189)
  • chore: ignore package-lock.json (#186)
  • chore: update renovate config (#184)
  • remove that whitespace (#183)
  • fix(deps): update dependency google-gax to ^0.18.0 (#182)
  • chore(deps): lock file maintenance (#181)
  • setup: just npm ci in synth.py (#180)
  • chore: move mocha options to mocha.opts (#177)
  • chore: require node 8 for samples (#179)
  • fix(deps): update dependency fluent-logger to v3 (#172)
  • fix: get eslint passing (#174)
  • chore(deps): update dependency eslint-plugin-node to v7 (#169)
  • test: use strictEqual in tests (#170)
  • fix(deps): update dependency gcp-metadata to ^0.7.0 (#166)
  • fix(deps): update dependency @google-cloud/logging to v2 (#157)