@google-cloud/logging-bunyan
Advanced tools
Comparing version 3.2.0 to 3.2.1
@@ -159,2 +159,3 @@ "use strict"; | ||
maxEntrySize: options.maxEntrySize || 250000, | ||
defaultWriteDeleteCallback: options.defaultCallback, | ||
}); | ||
@@ -161,0 +162,0 @@ // serviceContext.service is required by the Error Reporting |
@@ -69,3 +69,3 @@ "use strict"; | ||
}; | ||
function makeChildLogger(trace, span, sampled) { | ||
function makeChildLogger(trace, span) { | ||
return logger.child({ [index_1.LOGGING_TRACE_KEY]: trace, [index_1.LOGGING_SPAN_KEY]: span }, true /* simple child */); | ||
@@ -72,0 +72,0 @@ } |
@@ -17,2 +17,4 @@ /*! | ||
import {ApiResponseCallback} from '@google-cloud/logging/build/src/log'; | ||
export interface Options { | ||
@@ -82,2 +84,6 @@ /** | ||
maxEntrySize?: number; | ||
// A default global callback to be used for {@link LoggingBunyan} write calls | ||
// when callback is not supplied by caller in function parameters | ||
defaultCallback?: ApiResponseCallback; | ||
} | ||
@@ -84,0 +90,0 @@ |
@@ -7,2 +7,9 @@ # Changelog | ||
### [3.2.1](https://github.com/googleapis/nodejs-logging-bunyan/compare/v3.2.0...v3.2.1) (2022-03-02) | ||
### Bug Fixes | ||
* Update dependency @google-cloud/logging from 9.0.0 to 9.8.0 ([#597](https://github.com/googleapis/nodejs-logging-bunyan/issues/597)) ([a350362](https://github.com/googleapis/nodejs-logging-bunyan/commit/a350362ba78f275e4c294bfdf2ea5d868191e87e)) | ||
## [3.2.0](https://www.github.com/googleapis/nodejs-logging-bunyan/compare/v3.1.1...v3.2.0) (2021-12-09) | ||
@@ -9,0 +16,0 @@ |
{ | ||
"name": "@google-cloud/logging-bunyan", | ||
"description": "Cloud Logging stream for Bunyan", | ||
"version": "3.2.0", | ||
"version": "3.2.1", | ||
"license": "Apache-2.0", | ||
@@ -54,3 +54,3 @@ "author": "Google Inc.", | ||
"dependencies": { | ||
"@google-cloud/logging": "^9.0.0", | ||
"@google-cloud/logging": "^9.8.0", | ||
"google-auth-library": "^7.0.0" | ||
@@ -57,0 +57,0 @@ }, |
@@ -7,5 +7,4 @@ [//]: # "This README.md file is auto-generated, all changes to this file will be lost." | ||
[![release level](https://img.shields.io/badge/release%20level-general%20availability%20%28GA%29-brightgreen.svg?style=flat)](https://cloud.google.com/terms/launch-stages) | ||
[![release level](https://img.shields.io/badge/release%20level-stable-brightgreen.svg?style=flat)](https://cloud.google.com/terms/launch-stages) | ||
[![npm version](https://img.shields.io/npm/v/@google-cloud/logging-bunyan.svg)](https://www.npmjs.org/package/@google-cloud/logging-bunyan) | ||
[![codecov](https://img.shields.io/codecov/c/github/googleapis/nodejs-logging-bunyan/main.svg?style=flat)](https://codecov.io/gh/googleapis/nodejs-logging-bunyan) | ||
@@ -220,3 +219,24 @@ | ||
### Error handling with a default callback | ||
The `LoggingBunyan` class creates an instance of `Logging` which creates the `Log` class from `@google-cloud/logging` package to write log entries. | ||
The `Log` class writes logs asynchronously and there are cases when log entries cannot be written when it fails or an error is returned from Logging backend. | ||
If the error is not handled, it could crash the application. One possible way to handle the error is to provide a default callback | ||
to the `LoggingBunyan` constructor which will be used to initialize the `Log` object with that callback like in the example below: | ||
```js | ||
// Imports the Google Cloud client library for Bunyan | ||
const {LoggingBunyan} = require('@google-cloud/logging-bunyan'); | ||
// Creates a client | ||
const loggingBunyan = new LoggingBunyan({ | ||
projectId: 'your-project-id', | ||
keyFilename: '/path/to/key.json', | ||
defaultCallback: err => { | ||
if (err) { | ||
console.log('Error occured: ' + err); | ||
} | ||
}, | ||
}); | ||
``` | ||
## Samples | ||
@@ -242,18 +262,18 @@ | ||
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 via npm [dist-tags](https://docs.npmjs.com/cli/dist-tag). | ||
can be installed through npm [dist-tags](https://docs.npmjs.com/cli/dist-tag). | ||
The dist-tags follow the naming convention `legacy-(version)`. | ||
For example, `npm install @google-cloud/logging-bunyan@legacy-8` installs client libraries | ||
for versions compatible with Node.js 8. | ||
_Legacy Node.js versions are supported as a best effort:_ | ||
* Legacy versions will not be tested in continuous integration. | ||
* Some security patches may not be able to be backported. | ||
* Dependencies will not be kept up-to-date, and features will not be backported. | ||
#### Legacy tags available | ||
* `legacy-8`: install client libraries from this dist-tag for versions | ||
compatible with Node.js 8. | ||
## Versioning | ||
@@ -264,6 +284,6 @@ | ||
This library is considered to be **General Availability (GA)**. This means it | ||
is stable; the code surface will not change in backwards-incompatible ways | ||
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 **GA** libraries | ||
an extensive deprecation period. Issues and requests against **stable** libraries | ||
are addressed with the highest priority. | ||
@@ -275,2 +295,3 @@ | ||
More Information: [Google Cloud Platform Launch Stages][launch_stages] | ||
@@ -277,0 +298,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
84274
899
319
Updated@google-cloud/logging@^9.8.0