Skip to content

Commit

Permalink
fix: pass spread args instead of args; add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kjin committed Sep 6, 2018
1 parent f545013 commit 8c2aea2
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 10 deletions.
10 changes: 5 additions & 5 deletions src/logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,32 +65,32 @@ export class Logger {

this.logger = consoleLogLevel({
stderr: true,
prefix: opts && opts.tag ? opts.tag : '@google-cloud/trace-agent',
prefix: opts && opts.tag ? opts.tag : 'unknown',
level: levelName as ConsoleLogLevel
});
}

error(...args: Array<{}>): void {
if (this.logger) {
this.logger.error(args);
this.logger.error(...args);
}
}

warn(...args: Array<{}>): void {
if (this.logger) {
this.logger.warn(args);
this.logger.warn(...args);
}
}

debug(...args: Array<{}>): void {
if (this.logger) {
this.logger.debug(args);
this.logger.debug(...args);
}
}

info(...args: Array<{}>): void {
if (this.logger) {
this.logger.info(args);
this.logger.info(...args);
}
}
}
4 changes: 1 addition & 3 deletions test/test-env-log-level.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,10 @@
* limitations under the License.
*/

import * as common from '@google-cloud/common';
import * as assert from 'assert';
import * as shimmer from 'shimmer';

import * as logger from '../src/logger';
import {FORCE_NEW} from '../src/util';

import {TestLogger} from './logger';
import * as traceTestModule from './trace';
Expand Down Expand Up @@ -69,6 +67,6 @@ describe('should respect environment variables', () => {
assert.strictEqual(logLevel, logger.LEVELS[0]);
process.env.GCLOUD_TRACE_LOGLEVEL = '300';
traceTestModule.start();
assert.strictEqual(logLevel, logger.LEVELS[5]);
assert.strictEqual(logLevel, logger.LEVELS[4]);
});
});
1 change: 0 additions & 1 deletion test/test-modules-loaded-before-agent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
* limitations under the License.
*/

import * as common from '@google-cloud/common';
import * as assert from 'assert';
import * as shimmer from 'shimmer';

Expand Down
1 change: 0 additions & 1 deletion test/trace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
* Most tests should include this file instead of the main module root.
*/

import * as common from '@google-cloud/common';
import * as assert from 'assert';
import * as shimmer from 'shimmer';

Expand Down

0 comments on commit 8c2aea2

Please sign in to comment.