Socket
Socket
Sign inDemoInstall

@google-cloud/logging-min

Package Overview
Dependencies
Maintainers
4
Versions
54
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

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

Comparing version 9.6.1 to 9.6.2

2

build/src/entry.d.ts

@@ -90,2 +90,3 @@ /*!

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

@@ -124,2 +125,3 @@ * const logging = new Logging();

* });
* ```
*/

@@ -126,0 +128,0 @@ declare class Entry {

@@ -157,9 +157,14 @@ /*!

*
* @example <caption>Import the client library</caption>
* @example Import the client library
* ```
* const {Logging} = require('@google-cloud/logging');
*
* @example <caption>Create a client that uses <a href="https://cloud.google.com/docs/authentication/production#providing_credentials_to_your_application">Application Default Credentials (ADC)</a>:</caption>
* ```
* @example Create a client that uses <a href="https://cloud.google.com/docs/authentication/production#providing_credentials_to_your_application">Application Default Credentials (ADC)</a>:
* ```
* const logging = new Logging();
*
* @example <caption>Create a client with <a href="https://cloud.google.com/docs/authentication/production#obtaining_and_providing_service_account_credentials_manually">explicitcredentials</a>:</caption>
* ```
* @example Create a client with <a href="https://cloud.google.com/docs/authentication/production#obtaining_and_providing_service_account_credentials_manually">explicitcredentials</a>:
* ```
* const logging = new Logging({ projectId:

@@ -169,2 +174,3 @@ * 'your-project-id', keyFilename: '/path/to/keyfile.json'

*
* ```
* @example <caption>include:samples/quickstart.js</caption>

@@ -209,2 +215,3 @@ * region_tag:logging_quickstart

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

@@ -238,2 +245,3 @@ * const logging = new Logging();

* // }
* ```
*/

@@ -254,2 +262,3 @@ entry(resource?: LogEntry, data?: {} | string): Entry;

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

@@ -276,2 +285,3 @@ * const logging = new Logging();

* });
* ```
*/

@@ -307,2 +317,3 @@ getEntriesStream(options?: GetEntriesRequest): Duplex;

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

@@ -329,2 +340,3 @@ * const logging = new Logging();

* });
* ```
*/

@@ -344,2 +356,3 @@ tailEntries(options?: TailEntriesRequest): Duplex;

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

@@ -365,2 +378,3 @@ * const logging = new Logging();

* });
* ```
*/

@@ -381,2 +395,3 @@ getLogsStream(options?: GetLogsRequest): Duplex;

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

@@ -402,2 +417,3 @@ * const logging = new Logging();

* });
* ```
*/

@@ -417,5 +433,7 @@ getSinksStream(options: GetSinksRequest): Duplex;

* @example
* ```
* const {Logging} = require('@google-cloud/logging');
* const logging = new Logging();
* const log = logging.log('my-log');
* ```
*/

@@ -431,2 +449,3 @@ log(name: string, options?: LogOptions): Log;

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

@@ -441,2 +460,3 @@ * const logging = new Logging();

* const log = logging.logSync('my-log');
* ```
*/

@@ -453,5 +473,7 @@ logSync(name: string, transport?: Writable): LogSync;

* @example
* ```
* const {Logging} = require('@google-cloud/logging');
* const logging = new Logging();
* const sink = logging.sink('my-sink');
* ```
*/

@@ -570,14 +592,22 @@ sink(name: string): Sink;

*
* @example <caption>Install the client library with <a href="https://www.npmjs.com/">npm</a>:</caption>
* @example Install the client library with <a href="https://www.npmjs.com/">npm</a>:
* ```
* npm install --save @google-cloud/logging
*
* @example <caption>Import the client library</caption>
* ```
* @example Import the client library
* ```
* const {Logging} = require('@google-cloud/logging');
*
* @example <caption>Create a client that uses <a href="https://cloud.google.com/docs/authentication/production#providing_credentials_to_your_application">Application Default Credentials (ADC)</a>:</caption>
* ```
* @example Create a client that uses <a href="https://cloud.google.com/docs/authentication/production#providing_credentials_to_your_application">Application Default Credentials (ADC)</a>:
* ```
* const logging = new Logging();
*
* @example <caption>Create a client with <a href="https://cloud.google.com/docs/authentication/production#obtaining_and_providing_service_account_credentials_manually">explicit credentials</a>:</caption>
* ```
* @example Create a client with <a href="https://cloud.google.com/docs/authentication/production#obtaining_and_providing_service_account_credentials_manually">explicit credentials</a>:
* ```
* const logging = new Logging({ projectId: 'your-project-id', keyFilename: '/path/to/keyfile.json'});
*
* ```
* @example <caption>include:samples/quickstart.js</caption>

@@ -584,0 +614,0 @@ * region_tag:logging_quickstart

@@ -41,5 +41,7 @@ /*!

* @example
* ```
* const {Logging} = require('@google-cloud/logging');
* const logging = new Logging();
* const log = logging.logSync('mylog');
* ```
*/

@@ -61,2 +63,3 @@ declare class LogSync implements LogSeverityFunctions {

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

@@ -71,2 +74,3 @@ * const logging = new Logging();

* log.alert(entry);
* ```
*/

@@ -83,2 +87,3 @@ alert(entry: Entry | Entry[], options?: WriteOptions): void;

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

@@ -93,2 +98,3 @@ * const logging = new Logging();

* log.critical(entry);
* ```
*/

@@ -105,2 +111,3 @@ critical(entry: Entry | Entry[], options?: WriteOptions): void;

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

@@ -115,2 +122,3 @@ * const logging = new Logging();

* log.debug(entry);
* ```
*/

@@ -127,2 +135,3 @@ debug(entry: Entry | Entry[], options?: WriteOptions): void;

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

@@ -137,2 +146,3 @@ * const logging = new Logging();

* log.emergency(entry);
* ```
*/

@@ -152,2 +162,3 @@ emergency(entry: Entry | Entry[], options?: WriteOptions): void;

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

@@ -162,2 +173,3 @@ * const logging = new Logging();

* log.error(entry);
* ```
*/

@@ -174,2 +186,3 @@ error(entry: Entry | Entry[], options?: WriteOptions): void;

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

@@ -184,2 +197,3 @@ * const logging = new Logging();

* log.info(entry);
* ```
*/

@@ -196,2 +210,3 @@ info(entry: Entry | Entry[], options?: WriteOptions): void;

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

@@ -206,2 +221,3 @@ * const logging = new Logging();

* log.notice(entry);
* ```
*/

@@ -218,2 +234,3 @@ notice(entry: Entry | Entry[], options?: WriteOptions): void;

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

@@ -228,2 +245,3 @@ * const logging = new Logging();

* log.warning(entry);
* ```
*/

@@ -238,2 +256,3 @@ warning(entry: Entry | Entry[], options?: WriteOptions): void;

* @example
* ```
* const entry = log.entry('gce_instance', {

@@ -276,2 +295,3 @@ * instance: 'my_instance'

* });
* ```
*/

@@ -278,0 +298,0 @@ write(entry: Entry | Entry[], opts?: WriteOptions): void;

@@ -74,5 +74,7 @@ /*!

* @example
* ```
* const {Logging} = require('@google-cloud/logging');
* const logging = new Logging();
* const log = logging.log('syslog');
* ```
*/

@@ -120,2 +122,3 @@ declare class Log implements LogSeverityFunctions {

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

@@ -143,2 +146,3 @@ * const logging = new Logging();

* });
* ```
*/

@@ -157,2 +161,3 @@ getEntriesStream(options: GetEntriesRequest): import("stream").Duplex;

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

@@ -180,2 +185,3 @@ * const logging = new Logging();

* });
* ```
*/

@@ -182,0 +188,0 @@ tailEntries(options?: TailEntriesRequest): import("stream").Duplex;

2

build/src/log.js

@@ -1,2 +0,2 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.Log=void 0;const arrify=require("arrify");const promisify_1=require("@google-cloud/promisify");const dotProp=require("dot-prop");const extend=require("extend");const entry_1=require("./entry");const log_common_1=require("./utils/log-common");class Log{constructor(logging,name,options){options=options||{};this.formattedName_=log_common_1.formatLogName(logging.projectId,name);this.removeCircular_=options.removeCircular===true;this.maxEntrySize=options.maxEntrySize;this.logging=logging;this.name=this.formattedName_.split("/").pop()}alert(entry,options){return this.write(log_common_1.assignSeverityToEntries(entry,"ALERT"),options)}critical(entry,options){return this.write(log_common_1.assignSeverityToEntries(entry,"CRITICAL"),options)}debug(entry,options){return this.write(log_common_1.assignSeverityToEntries(entry,"DEBUG"),options)}async delete(gaxOptions){const projectId=await this.logging.auth.getProjectId();this.formattedName_=log_common_1.formatLogName(projectId,this.name);const reqOpts={logName:this.formattedName_};return this.logging.loggingService.deleteLog(reqOpts,gaxOptions)}emergency(entry,options){return this.write(log_common_1.assignSeverityToEntries(entry,"EMERGENCY"),options)}entry(metadataOrData,data){let metadata;if(!data&&(metadataOrData===null||metadataOrData===void 0?void 0:metadataOrData.hasOwnProperty("httpRequest"))){metadata=metadataOrData;data={}}else if(!data){data=metadataOrData;metadata={}}else{metadata=metadataOrData}return this.logging.entry(metadata,data)}error(entry,options){return this.write(log_common_1.assignSeverityToEntries(entry,"ERROR"),options)}async getEntries(opts){const options=extend({},opts);const projectId=await this.logging.auth.getProjectId();this.formattedName_=log_common_1.formatLogName(projectId,this.name);if(options.filter&&!options.filter.includes("logName=")){options.filter=`(${options.filter}) AND logName="${this.formattedName_}"`}else if(!options.filter){options.filter=`logName="${this.formattedName_}"`}return this.logging.getEntries(options)}getEntriesStream(options){options=extend({log:this.name},options);return this.logging.getEntriesStream(options)}tailEntries(options){options=extend({log:this.name},options);return this.logging.tailEntries(options)}info(entry,options){return this.write(log_common_1.assignSeverityToEntries(entry,"INFO"),options)}notice(entry,options){return this.write(log_common_1.assignSeverityToEntries(entry,"NOTICE"),options)}warning(entry,options){return this.write(log_common_1.assignSeverityToEntries(entry,"WARNING"),options)}async write(entry,opts){const options=opts?opts:{};let decoratedEntries;await this.logging.setProjectId();this.formattedName_=log_common_1.formatLogName(this.logging.projectId,this.name);const resource=await this.getOrSetResource(options);try{decoratedEntries=this.decorateEntries(arrify(entry))}catch(err){}this.truncateEntries(decoratedEntries);const reqOpts=extend({logName:this.formattedName_,entries:decoratedEntries,resource:resource},options);delete reqOpts.gaxOptions;return this.logging.loggingService.writeLogEntries(reqOpts,options.gaxOptions)}async getOrSetResource(options){if(options.resource){if(options.resource.labels)log_common_1.snakecaseKeys(options.resource.labels);return options.resource}await this.logging.setDetectedResource();return this.logging.detectedResource}decorateEntries(entries){return entries.map(entry=>{if(!(entry instanceof entry_1.Entry)){entry=this.entry(entry)}return entry.toJSON({removeCircular:this.removeCircular_},this.logging.projectId)})}truncateEntries(entries){return entries.forEach(entry=>{if(this.maxEntrySize===undefined)return;const payloadSize=JSON.stringify(entry).length;if(payloadSize<this.maxEntrySize)return;let delta=payloadSize-this.maxEntrySize;if(entry.textPayload){entry.textPayload=entry.textPayload.slice(0,Math.max(entry.textPayload.length-delta,0))}else{const fieldsToTruncate=["jsonPayload.fields.metadata.structValue.fields.stack.stringValue","jsonPayload.fields.msg.stringValue","jsonPayload.fields.err.structValue.fields.stack.stringValue","jsonPayload.fields.err.structValue.fields.message.stringValue","jsonPayload.fields.message.stringValue"];for(const field of fieldsToTruncate){const msg=dotProp.get(entry,field,"");if(msg!==""){dotProp.set(entry,field,msg.slice(0,Math.max(msg.length-delta,0)));delta-=Math.min(msg.length,delta)}}}})}static assignSeverityToEntries_(entries,severity){return log_common_1.assignSeverityToEntries(entries,severity)}static formatName_(projectId,name){return log_common_1.formatLogName(projectId,name)}}exports.Log=Log;promisify_1.callbackifyAll(Log,{exclude:["entry","getEntriesStream"]});
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.Log=void 0;const arrify=require("arrify");const promisify_1=require("@google-cloud/promisify");const dotProp=require("dot-prop");const extend=require("extend");const entry_1=require("./entry");const log_common_1=require("./utils/log-common");class Log{constructor(logging,name,options){options=options||{};this.formattedName_=log_common_1.formatLogName(logging.projectId,name);this.removeCircular_=options.removeCircular===true;this.maxEntrySize=options.maxEntrySize;this.logging=logging;this.name=this.formattedName_.split("/").pop()}alert(entry,options){return this.write(log_common_1.assignSeverityToEntries(entry,"ALERT"),options)}critical(entry,options){return this.write(log_common_1.assignSeverityToEntries(entry,"CRITICAL"),options)}debug(entry,options){return this.write(log_common_1.assignSeverityToEntries(entry,"DEBUG"),options)}async delete(gaxOptions){const projectId=await this.logging.auth.getProjectId();this.formattedName_=log_common_1.formatLogName(projectId,this.name);const reqOpts={logName:this.formattedName_};return this.logging.loggingService.deleteLog(reqOpts,gaxOptions)}emergency(entry,options){return this.write(log_common_1.assignSeverityToEntries(entry,"EMERGENCY"),options)}entry(metadataOrData,data){let metadata;if(!data&&(metadataOrData===null||metadataOrData===void 0?void 0:metadataOrData.hasOwnProperty("httpRequest"))){metadata=metadataOrData;data={}}else if(!data){data=metadataOrData;metadata={}}else{metadata=metadataOrData}return this.logging.entry(metadata,data)}error(entry,options){return this.write(log_common_1.assignSeverityToEntries(entry,"ERROR"),options)}async getEntries(opts){const options=extend({},opts);const projectId=await this.logging.auth.getProjectId();this.formattedName_=log_common_1.formatLogName(projectId,this.name);if(options.filter&&!options.filter.includes("logName=")){options.filter=`(${options.filter}) AND logName="${this.formattedName_}"`}else if(!options.filter){options.filter=`logName="${this.formattedName_}"`}return this.logging.getEntries(options)}getEntriesStream(options){options=extend({log:this.name},options);return this.logging.getEntriesStream(options)}tailEntries(options){options=extend({log:this.name},options);return this.logging.tailEntries(options)}info(entry,options){return this.write(log_common_1.assignSeverityToEntries(entry,"INFO"),options)}notice(entry,options){return this.write(log_common_1.assignSeverityToEntries(entry,"NOTICE"),options)}warning(entry,options){return this.write(log_common_1.assignSeverityToEntries(entry,"WARNING"),options)}async write(entry,opts){const options=opts?opts:{};await this.logging.setProjectId();this.formattedName_=log_common_1.formatLogName(this.logging.projectId,this.name);const resource=await this.getOrSetResource(options);const decoratedEntries=this.decorateEntries(arrify(entry));this.truncateEntries(decoratedEntries);const reqOpts=extend({logName:this.formattedName_,entries:decoratedEntries,resource:resource},options);delete reqOpts.gaxOptions;return this.logging.loggingService.writeLogEntries(reqOpts,options.gaxOptions)}async getOrSetResource(options){if(options.resource){if(options.resource.labels)log_common_1.snakecaseKeys(options.resource.labels);return options.resource}await this.logging.setDetectedResource();return this.logging.detectedResource}decorateEntries(entries){return entries.map(entry=>{if(!(entry instanceof entry_1.Entry)){entry=this.entry(entry)}return entry.toJSON({removeCircular:this.removeCircular_},this.logging.projectId)})}truncateEntries(entries){return entries.forEach(entry=>{if(this.maxEntrySize===undefined)return;const payloadSize=JSON.stringify(entry).length;if(payloadSize<this.maxEntrySize)return;let delta=payloadSize-this.maxEntrySize;if(entry.textPayload){entry.textPayload=entry.textPayload.slice(0,Math.max(entry.textPayload.length-delta,0))}else{const fieldsToTruncate=["jsonPayload.fields.metadata.structValue.fields.stack.stringValue","jsonPayload.fields.msg.stringValue","jsonPayload.fields.err.structValue.fields.stack.stringValue","jsonPayload.fields.err.structValue.fields.message.stringValue","jsonPayload.fields.message.stringValue"];for(const field of fieldsToTruncate){const msg=dotProp.get(entry,field,"");if(msg!==""){dotProp.set(entry,field,msg.slice(0,Math.max(msg.length-delta,0)));delta-=Math.min(msg.length,delta)}}}})}static assignSeverityToEntries_(entries,severity){return log_common_1.assignSeverityToEntries(entries,severity)}static formatName_(projectId,name){return log_common_1.formatLogName(projectId,name)}}exports.Log=Log;promisify_1.callbackifyAll(Log,{exclude:["entry","getEntriesStream"]});
//# sourceMappingURL=log.js.map

@@ -41,5 +41,7 @@ /*!

* @example
* ```
* const {Logging} = require('@google-cloud/logging');
* const logging = new Logging();
* const sink = logging.sink('my-sink');
* ```
*/

@@ -46,0 +48,0 @@ declare class Sink {

@@ -48,2 +48,3 @@ /*!

* @example
* ```
* ObjectToStructConverter.convert({

@@ -59,2 +60,3 @@ * aString: 'Hi'

* // }
* ```
*/

@@ -73,2 +75,3 @@ convert(obj: any): {

* @example
* ```
* ObjectToStructConverter.encodeValue('Hi');

@@ -78,2 +81,3 @@ * // {

* // }
* ```
*/

@@ -91,2 +95,3 @@ encodeValue_(value: {} | null): any;

* @example
* ```
* GrpcService.structToObj_({

@@ -103,2 +108,3 @@ * fields: {

* // }
* ```
*/

@@ -105,0 +111,0 @@ export declare function structToObj(struct: any): any;

@@ -124,2 +124,3 @@ /// <reference types="node" />

* @example
* ```
* const stream = client.tailLogEntries();

@@ -130,2 +131,3 @@ * stream.on('data', (response) => { ... });

* stream.end();
* ```
*/

@@ -252,2 +254,3 @@ tailLogEntries(options?: CallOptions): gax.CancellableStream;

* @example
* ```
* const iterable = client.listLogEntriesAsync(request);

@@ -257,2 +260,3 @@ * for await (const response of iterable) {

* }
* ```
*/

@@ -315,2 +319,3 @@ listLogEntriesAsync(request?: protos.google.logging.v2.IListLogEntriesRequest, options?: CallOptions): AsyncIterable<protos.google.logging.v2.ILogEntry>;

* @example
* ```
* const iterable = client.listMonitoredResourceDescriptorsAsync(request);

@@ -320,2 +325,3 @@ * for await (const response of iterable) {

* }
* ```
*/

@@ -416,2 +422,3 @@ listMonitoredResourceDescriptorsAsync(request?: protos.google.logging.v2.IListMonitoredResourceDescriptorsRequest, options?: CallOptions): AsyncIterable<protos.google.api.IMonitoredResourceDescriptor>;

* @example
* ```
* const iterable = client.listLogsAsync(request);

@@ -421,2 +428,3 @@ * for await (const response of iterable) {

* }
* ```
*/

@@ -423,0 +431,0 @@ listLogsAsync(request?: protos.google.logging.v2.IListLogsRequest, options?: CallOptions): AsyncIterable<string>;

@@ -179,2 +179,3 @@ /// <reference types="node" />

* @example
* ```
* const iterable = client.listLogMetricsAsync(request);

@@ -184,2 +185,3 @@ * for await (const response of iterable) {

* }
* ```
*/

@@ -186,0 +188,0 @@ listLogMetricsAsync(request?: protos.google.logging.v2.IListLogMetricsRequest, options?: CallOptions): AsyncIterable<protos.google.logging.v2.ILogMetric>;

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

### [9.6.2](https://www.github.com/googleapis/nodejs-logging/compare/v9.6.1...v9.6.2) (2021-11-01)
### Bug Fixes
* Cannot read property 'forEach' of undefined ([#1173](https://www.github.com/googleapis/nodejs-logging/issues/1173)) ([abf1ab0](https://www.github.com/googleapis/nodejs-logging/commit/abf1ab03483db8bf0c018524c348260a06193a4c))
### [9.6.1](https://www.github.com/googleapis/nodejs-logging/compare/v9.6.0...v9.6.1) (2021-09-30)

@@ -9,0 +16,0 @@

{
"name": "@google-cloud/logging-min",
"version": "9.6.1",
"version": "9.6.2",
"description": "Stackdriver Logging Client Library for Node.js",

@@ -70,3 +70,3 @@ "keywords": [

"@types/mocha": "^8.0.0",
"@types/node": "^14.0.0",
"@types/node": "^16.0.0",
"@types/on-finished": "^2.3.1",

@@ -73,0 +73,0 @@ "@types/proxyquire": "^1.3.28",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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