-
Notifications
You must be signed in to change notification settings - Fork 8
11. Using the Templating Engine
Ferron H edited this page Nov 5, 2016
·
3 revisions
Templates can be used to replace string contents with matching propert names of an object.
Just pass a truthy boolean as the fourth parameter of the getInstance()
method to activate the template engine.
Logs must follow a specific format for this engine to recognize templates. These logs will also be coloured once a custom colour is set.
The following example shows you how.
#####Eg.
app.controller('CoreController', ['$scope','$log', function($scope, $log) {
$log = $log.getInstance('CoreController', true, true);
$log.log('Advanced Log Extender Example: Use Case {example}', {example: 6});
}]);
######Output:
Dec-08-2013-1:00:47PM >> CONFIG: LOGGING ENABLED GLOBALLY
Dec-08-2013-1:00:47PM::CoreController >> Advanced Log Extender Example: Use Case 6
app.config(['logExProvider', function(logExProvider) {
logExProvider.useTemplates(true);
}]);
AngularLogExtender | License: MIT | Made with 💚