Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Redirect stderr to slog2 output for debug builds

Fixes blackberry/BB10-WebWorks-Framework#419

Reviewed By: James Keshavarzi <jkeshavarzi@rim.com>
tested By:  James Keshavarzi <jkeshavarzi@rim.com>
  • Loading branch information...
commit e076dceadfaec154101a41bad4bb085273cce432 1 parent 36fbbb4
@pagey pagey authored Nukul Bhasin committed
Showing with 31 additions and 0 deletions.
  1. +7 −0 lib/native-packager.js
  2. +24 −0 test/unit/lib/native-packager.js
View
7 lib/native-packager.js
@@ -59,6 +59,13 @@ function generateTabletXMLFile(session, config) {
}]
};
+ //Enable slog2 output if debugging
+ if (session.debug) {
+ xmlObject.env.push({
+ _attr : { value : 'slog2', var : 'CONSOLE_MODE' }
+ });
+ }
+
//If version can be attained, set env variable
if (webworksInfo && webworksInfo.version) {
xmlObject.env.push({
View
24 test/unit/lib/native-packager.js
@@ -147,6 +147,30 @@ describe("Native packager", function () {
expect(callback).toHaveBeenCalledWith(0);
});
+ it("makes sure slog2 logging is enabled in debug mode", function () {
+ var tabletXMLEntry = "<env value=\"slog2\" var=\"CONSOLE_MODE\"></env>";
+
+ //Silence the logger during unit tests
+ spyOn(logger, "warn").andCallFake(function () { });
+ spyOn(pkgrUtils, "writeFile").andCallFake(function (sourceDir, outputDir, data) {
+ expect(data).toContain(tabletXMLEntry);
+ });
+
+ session.debug = true;
+ nativePkgr.exec(session, target, testData.config, callback);
+ });
+
+ it("makes sure slog2 logging is not enabled when not in debug mode", function () {
+ var tabletXMLEntry = "<env value=\"slog2\" var=\"CONSOLE_MODE\"></env>";
+
+ spyOn(pkgrUtils, "writeFile").andCallFake(function (sourceDir, outputDir, data) {
+ expect(data).not.toContain(tabletXMLEntry);
+ });
+
+ session.debug = false;
+ nativePkgr.exec(session, target, testData.config, callback);
+ });
+
it("can process application name", function () {
var config = testUtils.cloneObj(testData.config);
config.name = {"default": "API Smoke Test"};
Please sign in to comment.
Something went wrong with that request. Please try again.