Skip to content
This repository has been archived by the owner on Sep 13, 2022. It is now read-only.

Commit

Permalink
Log only span context (#153)
Browse files Browse the repository at this point in the history
* Log only span context
* Pin `request` module to compatible version as the latest doesn't work under Node 0.10
  • Loading branch information
yurishkuro committed Sep 27, 2017
1 parent 51e40ec commit 5bdda39
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -44,7 +44,7 @@
"lodash": "^4.15.0",
"minimist": "1.2.0",
"mocha": "^3.0.1",
"request": "^2.74.0",
"request": "2.74.0",
"rsvp": "^3.3.1",
"semver": "^5",
"sinon": "^1.17.5",
Expand Down
2 changes: 1 addition & 1 deletion src/reporters/logging_reporter.js
Expand Up @@ -30,7 +30,7 @@ export default class LoggingReporter {
}

report(span: Span): void {
this._logger.info(`Reporting span ${JSON.stringify(span)}`);
this._logger.info(`Reporting span ${span.context().toString()}`);
}

name(): string {
Expand Down
14 changes: 11 additions & 3 deletions test/all_reporters.js
Expand Up @@ -78,14 +78,22 @@ describe('All Reporters should', () => {
});

describe('Logging reporter', () => {
it('report span logs span as a stringified object', () => {
it('logs span as context().toString()', () => {
let logger = new MockLogger();
let reporter = new LoggingReporter(logger);
let spanMock = { key: 'some-span' };
let spanMock = {
context: function context() {
return {
toString: function toString() {
return "span-as-string";
}
};
}
};

reporter.report(spanMock);

assert.equal(logger._infoMsgs[0], 'Reporting span {"key":"some-span"}');
assert.equal(logger._infoMsgs[0], 'Reporting span span-as-string');
});
});

Expand Down

0 comments on commit 5bdda39

Please sign in to comment.