Merge pull request #1643 from nasa/open1641

[Open 1641] Change warnings to info messages
This commit is contained in:
Pete Richards
2017-07-13 17:23:10 -07:00
committed by GitHub
4 changed files with 22 additions and 9 deletions

View File

@@ -75,6 +75,21 @@ define(
].join("")); ].join(""));
} }
//Log an info: defaults to "no service provide by"
function info(extension, category, message) {
var msg = message || "No service provided by";
$log.info([
msg,
" ",
category,
" ",
extension.key,
" from bundle ",
(extension.bundle || { path: "unknown bundle" }).path,
"; skipping."
].join(""));
}
// Echo arguments; used to represent groups of non-built-in // Echo arguments; used to represent groups of non-built-in
// extensions as a single dependency. // extensions as a single dependency.
function echoMany() { function echoMany() {
@@ -161,13 +176,13 @@ define(
name = makeName("aggregator", service, index); name = makeName("aggregator", service, index);
if (!service) { if (!service) {
return warn(aggregator, "aggregator"); return info(aggregator, "aggregator");
} }
// Aggregators need other services to aggregate, otherwise they // Aggregators need other services to aggregate, otherwise they
// do nothing. // do nothing.
if (!latest[service]) { if (!latest[service]) {
return warn( return info(
aggregator, aggregator,
"aggregator", "aggregator",
"No services to aggregate for" "No services to aggregate for"

View File

@@ -195,7 +195,8 @@ define(
expect(mockApp.service).not.toHaveBeenCalled(); expect(mockApp.service).not.toHaveBeenCalled();
// Should have gotten one warning for each skipped component // Should have gotten one warning for each skipped component
expect(mockLog.warn.calls.length).toEqual(3); expect(mockLog.warn.calls.length).toEqual(2);
expect(mockLog.info.calls.length).toEqual(1);
}); });
it("warns about and skips aggregators with zero providers", function () { it("warns about and skips aggregators with zero providers", function () {
@@ -217,7 +218,7 @@ define(
expect(mockApp.service).not.toHaveBeenCalled(); expect(mockApp.service).not.toHaveBeenCalled();
// Should have gotten a warning // Should have gotten a warning
expect(mockLog.warn).toHaveBeenCalled(); expect(mockLog.info).toHaveBeenCalled();
}); });
it("warns about and skips decorators with nothing to decorate", function () { it("warns about and skips decorators with nothing to decorate", function () {

View File

@@ -115,9 +115,7 @@ define(
return (this.telemetryService = return (this.telemetryService =
$injector.get("telemetryService")); $injector.get("telemetryService"));
} catch (e) { } catch (e) {
// $injector should throw if telemetryService $log.info("Telemetry service unavailable");
// is unavailable or unsatisfiable.
$log.warn("Telemetry service unavailable");
return (this.telemetryService = null); return (this.telemetryService = null);
} }
}; };
@@ -314,4 +312,3 @@ define(
return TelemetryCapability; return TelemetryCapability;
} }
); );

View File

@@ -199,7 +199,7 @@ define(
telemetry.requestData(); telemetry.requestData();
expect(mockLog.warn).toHaveBeenCalled(); expect(mockLog.info).toHaveBeenCalled();
}); });
it("if a new style telemetry source is available, use it", function () { it("if a new style telemetry source is available, use it", function () {