From 9cef6039e52d610c9612b4329ed060600a64369f Mon Sep 17 00:00:00 2001 From: Stephen Sawchuk Date: Fri, 18 Aug 2017 08:39:08 -0400 Subject: [PATCH] logging: restore library version to api-client header (#2540) --- src/index.js | 5 ++++- test/index.js | 9 +++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/index.js b/src/index.js index 3ccce7eb..3894d843 100644 --- a/src/index.js +++ b/src/index.js @@ -30,6 +30,7 @@ var pumpify = require('pumpify'); var streamEvents = require('stream-events'); var through = require('through2'); +var PKG = require('../package.json'); var v2 = require('./v2'); /** @@ -72,7 +73,9 @@ function Logging(options) { } var options_ = extend({ - scopes: v2.ALL_SCOPES + scopes: v2.ALL_SCOPES, + libName: 'gccl', + libVersion: PKG.version }, options); this.api = {}; diff --git a/test/index.js b/test/index.js index e1a9311d..2b333b87 100644 --- a/test/index.js +++ b/test/index.js @@ -23,6 +23,7 @@ var proxyquire = require('proxyquire'); var through = require('through2'); var util = require('@google-cloud/common').util; +var PKG = require('../package.json'); var v2 = require('../src/v2/index.js'); var extended = false; @@ -181,7 +182,9 @@ describe('Logging', function() { googleAutoAuthOverride = function(options_) { assert.deepEqual(options_, extend({ - scopes: v2.ALL_SCOPES + scopes: v2.ALL_SCOPES, + libName: 'gccl', + libVersion: PKG.version }, options)); return fakeGoogleAutoAuthInstance; }; @@ -201,7 +204,9 @@ describe('Logging', function() { assert.notStrictEqual(logging.options, options); assert.deepEqual(logging.options, extend({ - scopes: v2.ALL_SCOPES + scopes: v2.ALL_SCOPES, + libName: 'gccl', + libVersion: PKG.version }, options)); });