mirror of
https://github.com/nasa/openmct.git
synced 2025-06-17 14:48:13 +00:00
[Logging] Wire in log levels
Wire in log levels to allow specifying as a query string parameter; defaults to logging only warnings and above, for WTD-793.
This commit is contained in:
@ -43,7 +43,6 @@ define(
|
|||||||
log[m] = NOOP;
|
log[m] = NOOP;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return log;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Default to 'warn' level if unspecified
|
// Default to 'warn' level if unspecified
|
||||||
@ -67,7 +66,10 @@ define(
|
|||||||
configure: function (app, $log) {
|
configure: function (app, $log) {
|
||||||
decorate($log);
|
decorate($log);
|
||||||
app.config(function ($provide) {
|
app.config(function ($provide) {
|
||||||
$provide.decorator('$log', decorate);
|
$provide.decorator('$log', function ($delegate) {
|
||||||
|
decorate($delegate);
|
||||||
|
return $delegate;
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -19,6 +19,7 @@ define(
|
|||||||
'../lib/angular-route.min',
|
'../lib/angular-route.min',
|
||||||
'./Constants',
|
'./Constants',
|
||||||
'./FrameworkInitializer',
|
'./FrameworkInitializer',
|
||||||
|
'./LogLevel',
|
||||||
'./load/BundleLoader',
|
'./load/BundleLoader',
|
||||||
'./resolve/ImplementationLoader',
|
'./resolve/ImplementationLoader',
|
||||||
'./resolve/ExtensionResolver',
|
'./resolve/ExtensionResolver',
|
||||||
@ -36,6 +37,7 @@ define(
|
|||||||
angularRoute,
|
angularRoute,
|
||||||
Constants,
|
Constants,
|
||||||
FrameworkInitializer,
|
FrameworkInitializer,
|
||||||
|
LogLevel,
|
||||||
BundleLoader,
|
BundleLoader,
|
||||||
ImplementationLoader,
|
ImplementationLoader,
|
||||||
ExtensionResolver,
|
ExtensionResolver,
|
||||||
@ -52,6 +54,12 @@ define(
|
|||||||
// services, which are useful to the framework layer.
|
// services, which are useful to the framework layer.
|
||||||
var injector = angular.injector(['ng']);
|
var injector = angular.injector(['ng']);
|
||||||
|
|
||||||
|
// Look up log level from query string
|
||||||
|
function logLevel() {
|
||||||
|
var match = /[?&]log=([a-z]+)/.exec(window.location.search);
|
||||||
|
return match ? match[1] : "";
|
||||||
|
}
|
||||||
|
|
||||||
// Polyfill Promise, in case browser does not natively provide Promise
|
// Polyfill Promise, in case browser does not natively provide Promise
|
||||||
window.Promise = window.Promise || es6promise.Promise;
|
window.Promise = window.Promise || es6promise.Promise;
|
||||||
|
|
||||||
@ -86,6 +94,11 @@ define(
|
|||||||
bootstrapper
|
bootstrapper
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Apply logging levels; this must be done now, before the
|
||||||
|
// first log statement.
|
||||||
|
new LogLevel(logLevel()).configure(app, $log);
|
||||||
|
|
||||||
|
// Initialize the application
|
||||||
$log.info("Initializing application.");
|
$log.info("Initializing application.");
|
||||||
initializer.runApplication(Constants.BUNDLE_LISTING_FILE);
|
initializer.runApplication(Constants.BUNDLE_LISTING_FILE);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user