@google-cloud/logging
Advanced tools
Comparing version 10.1.7 to 10.1.8
@@ -47,3 +47,3 @@ /*! | ||
httpRequest?: object; | ||
timestamp?: string; | ||
timestamp?: Timestamp; | ||
[INSERT_ID_KEY]?: string; | ||
@@ -50,0 +50,0 @@ [OPERATION_KEY]?: object; |
@@ -148,8 +148,3 @@ "use strict"; | ||
if (entry.timestamp instanceof Date) { | ||
const seconds = entry.timestamp.getTime() / 1000; | ||
const secondsRounded = Math.floor(seconds); | ||
entry.timestamp = { | ||
seconds: secondsRounded, | ||
nanos: Math.floor((seconds - secondsRounded) * 1e9), | ||
}; | ||
entry.timestamp = (0, common_1.toNanosAndSecondsObj)(entry.timestamp); | ||
} | ||
@@ -226,3 +221,3 @@ else if (typeof entry.timestamp === 'string') { | ||
if (meta.timestamp instanceof Date) { | ||
entry.timestamp = meta.timestamp.toISOString(); | ||
entry.timestamp = (0, common_1.toNanosAndSecondsObj)(meta.timestamp); | ||
} | ||
@@ -229,0 +224,0 @@ // Format httprequest |
@@ -122,1 +122,10 @@ /*! | ||
}; | ||
/** | ||
* Converts Date to nanoseconds format suported by Logging. | ||
* See https://cloud.google.com/logging/docs/agent/logging/configuration#timestamp-processing for more details | ||
* @param date The date to be converted to Logging nanos and seconds format | ||
*/ | ||
export declare function toNanosAndSecondsObj(date: Date): { | ||
seconds: number; | ||
nanos: number; | ||
}; |
@@ -18,3 +18,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.zuluToDateObj = exports.decodeValue = exports.structToObj = exports.ObjectToStructConverter = exports.objToStruct = void 0; | ||
exports.toNanosAndSecondsObj = exports.zuluToDateObj = exports.decodeValue = exports.structToObj = exports.ObjectToStructConverter = exports.objToStruct = void 0; | ||
function objToStruct(obj, options) { | ||
@@ -242,2 +242,16 @@ return new ObjectToStructConverter(options).convert(obj); | ||
exports.zuluToDateObj = zuluToDateObj; | ||
/** | ||
* Converts Date to nanoseconds format suported by Logging. | ||
* See https://cloud.google.com/logging/docs/agent/logging/configuration#timestamp-processing for more details | ||
* @param date The date to be converted to Logging nanos and seconds format | ||
*/ | ||
function toNanosAndSecondsObj(date) { | ||
const seconds = date.getTime() / 1000; | ||
const secondsRounded = Math.floor(seconds); | ||
return { | ||
seconds: secondsRounded, | ||
nanos: Math.floor((seconds - secondsRounded) * 1e9), | ||
}; | ||
} | ||
exports.toNanosAndSecondsObj = toNanosAndSecondsObj; | ||
//# sourceMappingURL=common.js.map |
@@ -21,3 +21,2 @@ "use strict"; | ||
const path = require("path"); | ||
const protos_1 = require("../../protos/protos"); | ||
const entry_1 = require("../entry"); | ||
@@ -87,5 +86,3 @@ // The global variable keeping track if instrumentation record was already written or not. | ||
} | ||
const entry = new entry_1.Entry({ | ||
severity: protos_1.google.logging.type.LogSeverity.INFO, | ||
}, { | ||
const entry = new entry_1.Entry(undefined, { | ||
[exports.DIAGNOSTIC_INFO_KEY]: { | ||
@@ -92,0 +89,0 @@ [exports.INSTRUMENTATION_SOURCE_KEY]: [ |
{ | ||
"name": "@google-cloud/logging", | ||
"version": "10.1.7", | ||
"version": "10.1.8", | ||
"description": "Cloud Logging Client Library for Node.js", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
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
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
4206738
70975