Socket
Socket
Sign inDemoInstall

@google-cloud/logging-bunyan

Package Overview
Dependencies
Maintainers
1
Versions
53
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@google-cloud/logging-bunyan - npm Package Compare versions

Comparing version 2.0.3 to 3.0.0

16

build/src/index.js

@@ -18,6 +18,7 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.LoggingBunyan = exports.LOGGING_TRACE_KEY = exports.express = void 0;
const stream_1 = require("stream");
const express = require("./middleware/express");
exports.express = express;
const { Logging, detectServiceContext } = require('@google-cloud/logging');
const logging_1 = require("@google-cloud/logging");
// Map of Stackdriver logging levels.

@@ -135,3 +136,4 @@ const BUNYAN_TO_STACKDRIVER = new Map([

this.serviceContext = options.serviceContext;
this.stackdriverLog = new Logging(options).log(this.logName, {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
this.stackdriverLog = new logging_1.Logging(options).log(this.logName, {
removeCircular: true,

@@ -151,8 +153,8 @@ // See: https://cloud.google.com/logging/quotas, a log size of

if (this.serviceContext && !this.serviceContext.service) {
throw new Error(`If 'serviceContext' is specified then ` +
`'serviceContext.service' is required.`);
throw new Error("If 'serviceContext' is specified then " +
"'serviceContext.service' is required.");
}
/* Asynchrnously attempt to discover the service context. */
if (!this.serviceContext) {
detectServiceContext(this.stackdriverLog.logging.auth).then((serviceContext) => {
logging_1.detectServiceContext(this.stackdriverLog.logging.auth).then(serviceContext => {
this.serviceContext = serviceContext;

@@ -227,3 +229,3 @@ }, () => {

}
// tslint:disable-next-line:no-any
// eslint-disable-next-line @typescript-eslint/no-explicit-any
static properLabels(labels) {

@@ -240,3 +242,3 @@ if (typeof labels !== 'object')

// Writable.write used 'any' in function signature.
// tslint:disable-next-line:no-any
// eslint-disable-next-line @typescript-eslint/no-explicit-any
write(...args) {

@@ -243,0 +245,0 @@ let record = args[0];

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.middleware = exports.APP_LOG_SUFFIX = void 0;
/*!

@@ -4,0 +5,0 @@ * Copyright 2018 Google LLC

@@ -22,3 +22,3 @@ /*!

*/
logName?: string,
logName?: string;
/**

@@ -30,3 +30,3 @@ * The monitored resource that the log stream corresponds to. On Google Cloud

*/
resource?: MonitoredResource,
resource?: MonitoredResource;
/**

@@ -37,11 +37,11 @@ * For logged errors, we provide this as the service context. For more

*/
serviceContext?: ServiceContext,
serviceContext?: ServiceContext;
/**
* The project ID from the Google Cloud
* Console, e.g. 'grape-spaceship-123'. We will also check the environment
* variable `GCLOUD_PROJECT` for your project ID. If your app is running in
* an environment which supports {@link https://cloud.google.com/docs/authentication/production#providing_credentials_to_your_application Application Default Credentials},
* your project ID will be detected automatically.
* Console, e.g. 'grape-spaceship-123'. We will also check the environment
* variable `GCLOUD_PROJECT` for your project ID. If your app is running in
* an environment which supports {@link https://cloud.google.com/docs/authentication/production#providing_credentials_to_your_application Application Default Credentials},
* your project ID will be detected automatically.
*/
projectId?: string,
projectId?: string;
/**

@@ -53,11 +53,11 @@ * Full path to the a .json, .pem, or .p12 key downloaded from the Google

*/
keyFilename?: string,
keyFilename?: string;
/**
* Account email address. Required when using a .pem or .p12 keyFilename.
*/
email?: string,
email?: string;
/**
* Credentials object.
*/
credentials?: Credentials,
credentials?: Credentials;
/**

@@ -68,7 +68,7 @@ * Automatically retry requests if the response is related to rate limits or

*/
autoRetry?: boolean,
autoRetry?: boolean;
/**
* Maximum number of automatic retries attempted before returning the error.
*/
maxRetries?: number,
maxRetries?: number;
/**

@@ -78,3 +78,3 @@ * Custom promise module to use instead of native Promises.

// TODO: address the correct type of promise.
promise?: {}
promise?: {};
/**

@@ -107,12 +107,49 @@ * The host name of the service to send requests.

export interface StackdriverLog {
critical: (entry: StackdriverEntry|StackdriverEntry[], options?: {}, callback?: (err: Error, apiResponse: {}) => void) => Promise<LogWriteResponse>;
debug: (entry: StackdriverEntry|StackdriverEntry[], options?: {}, callback?: (err: Error, apiResponse: {}) => void) => Promise<LogWriteResponse>;
emergency: (entry: StackdriverEntry|StackdriverEntry[], options?: {}, callback?: (err: Error, apiResponse: {}) => void) => Promise<LogWriteResponse>;
error: (entry: StackdriverEntry|StackdriverEntry[], options?: {}, callback?: (err: Error, apiResponse: {}) => void) => Promise<LogWriteResponse>;
info: (entry: StackdriverEntry|StackdriverEntry[], options?: {}, callback?: (err: Error, apiResponse: {}) => void) => Promise<LogWriteResponse>;
notice: (entry: StackdriverEntry|StackdriverEntry[], options?: {}, callback?: (err: Error, apiResponse: {}) => void) => Promise<LogWriteResponse>;
warning: (entry: StackdriverEntry|StackdriverEntry[], options?: {}, callback?: (err: Error, apiResponse: {}) => void) => Promise<LogWriteResponse>;
write: (entry: StackdriverEntry|StackdriverEntry[], options?: {}, callback?: (err: Error, apiResponse: {}) => void) => Promise<LogWriteResponse>;
alert: (entry: StackdriverEntry|StackdriverEntry[], options?: {}, callback?: (err: Error, apiResponse: {}) => void) => Promise<LogWriteResponse>;
entry: (metadata: {}, data: {}|string) => StackdriverEntry;
critical: (
entry: StackdriverEntry | StackdriverEntry[],
options?: {},
callback?: (err: Error, apiResponse: {}) => void
) => Promise<LogWriteResponse>;
debug: (
entry: StackdriverEntry | StackdriverEntry[],
options?: {},
callback?: (err: Error, apiResponse: {}) => void
) => Promise<LogWriteResponse>;
emergency: (
entry: StackdriverEntry | StackdriverEntry[],
options?: {},
callback?: (err: Error, apiResponse: {}) => void
) => Promise<LogWriteResponse>;
error: (
entry: StackdriverEntry | StackdriverEntry[],
options?: {},
callback?: (err: Error, apiResponse: {}) => void
) => Promise<LogWriteResponse>;
info: (
entry: StackdriverEntry | StackdriverEntry[],
options?: {},
callback?: (err: Error, apiResponse: {}) => void
) => Promise<LogWriteResponse>;
notice: (
entry: StackdriverEntry | StackdriverEntry[],
options?: {},
callback?: (err: Error, apiResponse: {}) => void
) => Promise<LogWriteResponse>;
warning: (
entry: StackdriverEntry | StackdriverEntry[],
options?: {},
callback?: (err: Error, apiResponse: {}) => void
) => Promise<LogWriteResponse>;
write: (
entry: StackdriverEntry | StackdriverEntry[],
options?: {},
callback?: (err: Error, apiResponse: {}) => void
) => Promise<LogWriteResponse>;
alert: (
entry: StackdriverEntry | StackdriverEntry[],
options?: {},
callback?: (err: Error, apiResponse: {}) => void
) => Promise<LogWriteResponse>;
entry: (metadata: {}, data: {} | string) => StackdriverEntry;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
logging: any;

@@ -127,28 +164,67 @@ }

export interface StackdriverEntryMetadata {
resource?: MonitoredResource,
timestamp?: Date,
severity?: string, // figure out the correct type later
httpRequest?: HttpRequest,
labels?: {},
trace?: {}
resource?: MonitoredResource;
timestamp?: Date;
severity?: string; // figure out the correct type later
httpRequest?: HttpRequest;
labels?: {};
trace?: {};
}
export interface StackdriverLog {
critical: (entry: StackdriverEntry|StackdriverEntry[], options?: {}, callback?: (err: Error, apiResponse: {}) => void) => Promise<LogWriteResponse>,
debug: (entry: StackdriverEntry|StackdriverEntry[], options?: {}, callback?: (err: Error, apiResponse: {}) => void) => Promise<LogWriteResponse>,
emergency: (entry: StackdriverEntry|StackdriverEntry[], options?: {}, callback?: (err: Error, apiResponse: {}) => void) => Promise<LogWriteResponse>,
error: (entry: StackdriverEntry|StackdriverEntry[], options?: {}, callback?: (err: Error, apiResponse: {}) => void) => Promise<LogWriteResponse>,
info: (entry: StackdriverEntry|StackdriverEntry[], options?: {}, callback?: (err: Error, apiResponse: {}) => void) => Promise<LogWriteResponse>,
notice: (entry: StackdriverEntry|StackdriverEntry[], options?: {}, callback?: (err: Error, apiResponse: {}) => void) => Promise<LogWriteResponse>,
warning: (entry: StackdriverEntry|StackdriverEntry[], options?: {}, callback?: (err: Error, apiResponse: {}) => void) => Promise<LogWriteResponse>,
write: (entry: StackdriverEntry|StackdriverEntry[], options?: {}, callback?: (err: Error, apiResponse: {}) => void) => Promise<LogWriteResponse>,
alert: (entry: StackdriverEntry|StackdriverEntry[], options?: {}, callback?: (err: Error, apiResponse: {}) => void) => Promise<LogWriteResponse>,
entry: (metadata: {}, data: {}|string) => StackdriverEntry
critical: (
entry: StackdriverEntry | StackdriverEntry[],
options?: {},
callback?: (err: Error, apiResponse: {}) => void
) => Promise<LogWriteResponse>;
debug: (
entry: StackdriverEntry | StackdriverEntry[],
options?: {},
callback?: (err: Error, apiResponse: {}) => void
) => Promise<LogWriteResponse>;
emergency: (
entry: StackdriverEntry | StackdriverEntry[],
options?: {},
callback?: (err: Error, apiResponse: {}) => void
) => Promise<LogWriteResponse>;
error: (
entry: StackdriverEntry | StackdriverEntry[],
options?: {},
callback?: (err: Error, apiResponse: {}) => void
) => Promise<LogWriteResponse>;
info: (
entry: StackdriverEntry | StackdriverEntry[],
options?: {},
callback?: (err: Error, apiResponse: {}) => void
) => Promise<LogWriteResponse>;
notice: (
entry: StackdriverEntry | StackdriverEntry[],
options?: {},
callback?: (err: Error, apiResponse: {}) => void
) => Promise<LogWriteResponse>;
warning: (
entry: StackdriverEntry | StackdriverEntry[],
options?: {},
callback?: (err: Error, apiResponse: {}) => void
) => Promise<LogWriteResponse>;
write: (
entry: StackdriverEntry | StackdriverEntry[],
options?: {},
callback?: (err: Error, apiResponse: {}) => void
) => Promise<LogWriteResponse>;
alert: (
entry: StackdriverEntry | StackdriverEntry[],
options?: {},
callback?: (err: Error, apiResponse: {}) => void
) => Promise<LogWriteResponse>;
entry: (metadata: {}, data: {} | string) => StackdriverEntry;
}
export interface StackdriverLogging {
Entry?: StackdriverEntry,
Log?: StackdriverLog,
Logging?: StackdriverLogging,
entry?: (resource?: MonitoredResource, data?: {message: string}|string) => StackdriverEntry
Entry?: StackdriverEntry;
Log?: StackdriverLog;
Logging?: StackdriverLogging;
entry?: (
resource?: MonitoredResource,
data?: {message: string} | string
) => StackdriverEntry;
// define additional properties and methods.

@@ -158,5 +234,8 @@ }

export interface StackdriverEntry {
constructor: (metadata?: StackdriverEntryMetadata, data?: {message: string}| string) => StackdriverEntry,
data?: StackdriverData|string,
metadata?: StackdriverEntryMetadata
constructor: (
metadata?: StackdriverEntryMetadata,
data?: {message: string} | string
) => StackdriverEntry;
data?: StackdriverData | string;
metadata?: StackdriverEntryMetadata;
}

@@ -180,39 +259,46 @@

export interface HttpRequest {
requestMethod: string,
requestUrl: string,
requestSize: string,
status: number,
responseSize: string,
userAgent: string,
remoteIp: string,
serverIp: string,
referer: string,
latency: string,
cacheLookup: boolean,
cacheHit: boolean,
cacheValidatedWithOriginServer: boolean,
cacheFillBytes: string,
protocol: string,
requestMethod?: string;
requestUrl?: string;
requestSize?: number;
status?: number;
responseSize?: number;
userAgent?: string;
remoteIp?: string;
serverIp?: string;
referer?: string;
latency?: string | {seconds: number; nanos: number};
cacheLookup?: boolean;
cacheHit?: boolean;
cacheValidatedWithOriginServer?: boolean;
cacheFillBytes?: number;
protocol?: string;
}
export interface BunyanLogRecord {
message?: string,
msg?: string,
err?: Error,
serviceContext?: ServiceContext,
level?: string,
time?: Date,
httpRequest?: HttpRequest,
message?: string;
msg?: string;
err?: Error;
serviceContext?: ServiceContext;
level?: string;
time?: Date;
httpRequest?: HttpRequest;
labels?: {};
// And arbitrary other properties.
// tslint:disable-next-line:no-any
// eslint-disable-next-line @typescript-eslint/no-explicit-any
[key: string]: any;
}
export type LogLevel = 'trace' | 'debug' | 'info' | 'warn' | 'error' | 'fatal' | number;
export type LogLevel =
| 'trace'
| 'debug'
| 'info'
| 'warn'
| 'error'
| 'fatal'
| number;
export interface StreamResponse {
level: LogLevel,
type: string,
stream: NodeJS.WritableStream
level: LogLevel;
type: string;
stream: NodeJS.WritableStream;
}

@@ -19,4 +19,5 @@ /*!

export interface Global {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
_google_trace_agent: any;
}
}

@@ -7,2 +7,20 @@ # Changelog

## [3.0.0](https://www.github.com/googleapis/nodejs-logging-bunyan/compare/v2.0.3...v3.0.0) (2020-05-20)
### ⚠ BREAKING CHANGES
* drop support for node.js 8.x (#440)
### Bug Fixes
* apache license URL ([#468](https://www.github.com/googleapis/nodejs-logging-bunyan/issues/468)) ([#436](https://www.github.com/googleapis/nodejs-logging-bunyan/issues/436)) ([51f5182](https://www.github.com/googleapis/nodejs-logging-bunyan/commit/51f518206f52fdc31773e9625a289f9d25f03abb))
* update HttpRequest to match @google-cloud/logging ([#412](https://www.github.com/googleapis/nodejs-logging-bunyan/issues/412)) ([0c32a6c](https://www.github.com/googleapis/nodejs-logging-bunyan/commit/0c32a6c5014ac1c4ec54103bd610eae75ef2426a))
* **deps:** update dependency google-auth-library to v6 ([#427](https://www.github.com/googleapis/nodejs-logging-bunyan/issues/427)) ([03c6c8a](https://www.github.com/googleapis/nodejs-logging-bunyan/commit/03c6c8a9ff9003e906aeea8bec806a87fadef2c3))
### Build System
* drop support for node.js 8.x ([#440](https://www.github.com/googleapis/nodejs-logging-bunyan/issues/440)) ([b816566](https://www.github.com/googleapis/nodejs-logging-bunyan/commit/b81656645e7a17adfdb1fb78de8e2153128fe2a5))
### [2.0.3](https://www.github.com/googleapis/nodejs-logging-bunyan/compare/v2.0.2...v2.0.3) (2020-01-24)

@@ -9,0 +27,0 @@

{
"name": "@google-cloud/logging-bunyan",
"description": "Stackdriver Logging stream for Bunyan",
"version": "2.0.3",
"version": "3.0.0",
"license": "Apache-2.0",
"author": "Google Inc.",
"engines": {
"node": ">=8.10.0"
"node": ">=10"
},

@@ -36,3 +36,3 @@ "repository": "googleapis/nodejs-logging-bunyan",

"docs": "jsdoc -c .jsdoc.js",
"lint": "gts check && eslint '**/*.js'",
"lint": "gts check",
"presamples-test": "npm run compile",

@@ -46,20 +46,22 @@ "presystem-test": "npm run compile",

"postcompile": "cpy ./src/types/* ./build/src/types",
"fix": "gts fix && eslint --fix '**/*.js'",
"fix": "gts fix",
"prepare": "npm run compile",
"pretest": "npm run compile",
"docs-test": "linkinator docs",
"predocs-test": "npm run docs"
"predocs-test": "npm run docs",
"prelint": "cd samples; npm link ../; npm install",
"precompile": "gts clean"
},
"dependencies": {
"@google-cloud/logging": "^7.0.0",
"google-auth-library": "^5.0.0"
"google-auth-library": "^6.0.0"
},
"devDependencies": {
"@google-cloud/common": "^2.0.0",
"@google-cloud/common": "^3.0.0",
"@types/bunyan": "^1.8.4",
"@types/express": "^4.16.0",
"@types/mocha": "^5.2.3",
"@types/mocha": "^7.0.0",
"@types/node": "^10.3.6",
"@types/proxyquire": "^1.3.28",
"@types/uuid": "^3.4.4",
"@types/uuid": "^8.0.0",
"bunyan": "^1.8.12",

@@ -70,21 +72,13 @@ "c8": "^7.0.0",

"delay": "^4.1.0",
"eslint": "^6.0.0",
"eslint-config-prettier": "^6.0.0",
"eslint-plugin-node": "^11.0.0",
"eslint-plugin-prettier": "^3.0.0",
"express": "^4.16.3",
"gts": "^1.0.0",
"intelli-espower-loader": "^1.0.1",
"gts": "^2.0.0",
"jsdoc": "^3.6.2",
"jsdoc-fresh": "^1.0.1",
"jsdoc-region-tag": "^1.0.2",
"linkinator": "^1.5.0",
"mocha": "^7.0.0",
"linkinator": "^2.0.0",
"mocha": "^7.1.1",
"post-install-check": "0.0.1",
"power-assert": "^1.6.0",
"prettier": "^1.13.6",
"proxyquire": "^2.0.1",
"source-map-support": "^0.5.6",
"typescript": "3.6.4",
"uuid": "^3.3.2"
"typescript": "^3.8.3",
"uuid": "^8.0.0"
},

@@ -91,0 +85,0 @@ "peerDependencies": {

@@ -235,2 +235,23 @@ [//]: # "This README.md file is auto-generated, all changes to this file will be lost."

## Supported Node.js Versions
Our client libraries follow the [Node.js release schedule](https://nodejs.org/en/about/releases/).
Libraries are compatible with all current _active_ and _maintenance_ versions of
Node.js.
Client libraries targetting 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).
The dist-tags follow the naming convention `legacy-(version)`.
_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

@@ -259,2 +280,8 @@

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 template in this
[directory](https://github.com/googleapis/synthtool/tree/master/synthtool/gcp/templates/node_library).
## License

@@ -261,0 +288,0 @@

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