Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@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 3.0.2 to 3.1.0

20

build/src/index.d.ts

@@ -24,6 +24,24 @@ /*!

* request, and to store as an intermediate value on the log entry before it
* gets written to the Stackdriver logging API.
* gets written to the Cloud Logging logging API.
*/
export declare const LOGGING_TRACE_KEY = "logging.googleapis.com/trace";
/**
* Key to use in the Bunyan payload to allow users to indicate a spanId for the
* request, and to store as an intermediate value on the log entry before it
* gets written to the Cloud logging API.
*/
export declare const LOGGING_SPAN_KEY = "logging.googleapis.com/spanId";
/**
* Key to use in the Bunyan payload to allow users to indicate a traceSampled
* flag for the request, and to store as an intermediate value on the log entry
* before it gets written to the Cloud logging API.
*/
export declare const LOGGING_SAMPLED_KEY = "logging.googleapis.com/trace_sampled";
/**
* Gets the current fully qualified trace ID when available from the
* @google-cloud/trace-agent library in the LogEntry.trace field format of:
* "projects/[PROJECT-ID]/traces/[TRACE-ID]".
*/
export declare function getCurrentTraceFromAgent(): string | null;
/**
* This module provides support for streaming your Bunyan logs to

@@ -30,0 +48,0 @@ * [Stackdriver Logging](https://cloud.google.com/logging).

@@ -18,3 +18,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.LoggingBunyan = exports.LOGGING_TRACE_KEY = exports.express = void 0;
exports.LoggingBunyan = exports.getCurrentTraceFromAgent = exports.LOGGING_SAMPLED_KEY = exports.LOGGING_SPAN_KEY = exports.LOGGING_TRACE_KEY = exports.express = void 0;
const stream_1 = require("stream");

@@ -36,6 +36,18 @@ const express = require("./middleware/express");

* request, and to store as an intermediate value on the log entry before it
* gets written to the Stackdriver logging API.
* gets written to the Cloud Logging logging API.
*/
exports.LOGGING_TRACE_KEY = 'logging.googleapis.com/trace';
/**
* Key to use in the Bunyan payload to allow users to indicate a spanId for the
* request, and to store as an intermediate value on the log entry before it
* gets written to the Cloud logging API.
*/
exports.LOGGING_SPAN_KEY = 'logging.googleapis.com/spanId';
/**
* Key to use in the Bunyan payload to allow users to indicate a traceSampled
* flag for the request, and to store as an intermediate value on the log entry
* before it gets written to the Cloud logging API.
*/
exports.LOGGING_SAMPLED_KEY = 'logging.googleapis.com/trace_sampled';
/**
* Gets the current fully qualified trace ID when available from the

@@ -60,2 +72,3 @@ * @google-cloud/trace-agent library in the LogEntry.trace field format of:

}
exports.getCurrentTraceFromAgent = getCurrentTraceFromAgent;
/**

@@ -227,2 +240,10 @@ * This module provides support for streaming your Bunyan logs to

}
if (record[exports.LOGGING_SPAN_KEY]) {
entryMetadata.spanId = record[exports.LOGGING_SPAN_KEY];
delete record[exports.LOGGING_SPAN_KEY];
}
if (exports.LOGGING_SAMPLED_KEY in record) {
entryMetadata.traceSampled = record[exports.LOGGING_SAMPLED_KEY];
delete record[exports.LOGGING_SAMPLED_KEY];
}
return this.stackdriverLog.entry(entryMetadata, record);

@@ -297,2 +318,16 @@ }

module.exports.LOGGING_TRACE_KEY = exports.LOGGING_TRACE_KEY;
/**
* Value: `logging.googleapis.com/spanId`
*
* @name LoggingBunyan.LOGGING_SPAN_KEY
* @type {string}
*/
module.exports.LOGGING_SPAN_KEY = exports.LOGGING_SPAN_KEY;
/**
* Value: `logging.googleapis.com/trace_sampled`
*
* @name LoggingBunyan.LOGGING_SAMPLED_KEY
* @type {string}
*/
module.exports.LOGGING_SAMPLED_KEY = exports.LOGGING_SAMPLED_KEY;
//# sourceMappingURL=index.js.map

13

build/src/middleware/express.js

@@ -56,4 +56,9 @@ "use strict";

});
emitRequestLog = (httpRequest, trace) => {
requestLogger.info({ [index_1.LOGGING_TRACE_KEY]: trace, httpRequest });
emitRequestLog = (httpRequest, trace, span, sampled) => {
requestLogger.info({
[index_1.LOGGING_TRACE_KEY]: trace,
[index_1.LOGGING_SPAN_KEY]: span,
[index_1.LOGGING_SAMPLED_KEY]: sampled,
httpRequest,
});
};

@@ -65,4 +70,4 @@ }

};
function makeChildLogger(trace) {
return logger.child({ [index_1.LOGGING_TRACE_KEY]: trace }, true /* simple child */);
function makeChildLogger(trace, span, sampled) {
return logger.child({ [index_1.LOGGING_TRACE_KEY]: trace, [index_1.LOGGING_SPAN_KEY]: span }, true /* simple child */);
}

@@ -69,0 +74,0 @@ }

@@ -163,2 +163,4 @@ /*!

trace?: {};
spanId?: {};
traceSampled?: {};
}

@@ -165,0 +167,0 @@

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

## [3.1.0](https://www.github.com/googleapis/nodejs-logging-bunyan/compare/v3.0.2...v3.1.0) (2021-06-15)
### Features
* add spanId and traceSampled logic ([#543](https://www.github.com/googleapis/nodejs-logging-bunyan/issues/543)) ([548111b](https://www.github.com/googleapis/nodejs-logging-bunyan/commit/548111b87e4817b410cc2d6a13cc468a78aa5f8a))
### [3.0.2](https://www.github.com/googleapis/nodejs-logging-bunyan/compare/v3.0.1...v3.0.2) (2021-02-09)

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

{
"name": "@google-cloud/logging-bunyan",
"description": "Cloud Logging stream for Bunyan",
"version": "3.0.2",
"version": "3.1.0",
"license": "Apache-2.0",

@@ -51,5 +51,3 @@ "author": "Google Inc.",

"prelint": "cd samples; npm link ../; npm install",
"precompile": "gts clean",
"api-extractor": "api-extractor run --local",
"api-documenter": "api-documenter yaml --input-folder=temp"
"precompile": "gts clean"
},

@@ -83,5 +81,3 @@ "dependencies": {

"typescript": "^3.8.3",
"uuid": "^8.0.0",
"@microsoft/api-documenter": "^7.8.10",
"@microsoft/api-extractor": "^7.8.10"
"uuid": "^8.0.0"
},

@@ -88,0 +84,0 @@ "peerDependencies": {

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

This module provides an easy to use, higher-level layer for working with [Cloud Logging](https://cloud.google.com/logging/docs),
compatible with [Bunyan](https://www.npmjs.com/package/bunyan). Simply attach this as a transport to your existing Bunyan loggers.
# [Cloud Logging for Bunyan: Node.js Client](https://github.com/googleapis/nodejs-logging-bunyan)
[![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)

@@ -17,3 +15,4 @@ [![npm version](https://img.shields.io/npm/v/@google-cloud/logging-bunyan.svg)](https://www.npmjs.org/package/@google-cloud/logging-bunyan)

Cloud Logging stream for Bunyan
This module provides an easy to use, higher-level layer for working with [Cloud Logging](https://cloud.google.com/logging/docs),
compatible with [Bunyan](https://www.npmjs.com/package/bunyan). Simply attach this as a transport to your existing Bunyan loggers.

@@ -20,0 +19,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