Created
December 9, 2013 16:51
-
-
Save adamcarr/7875676 to your computer and use it in GitHub Desktop.
Activity Logging Example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var initializeActivity = loggerService.startActivity(activities.testController.INITIALIZE); | |
$scope.currentDateTime = new Date(); | |
loggerService.log('Setting $scope.currentDateTime to the current time: [' + $scope.currentDateTime + ']'); | |
loggerService.endActivity(activities.testController.INITIALIZE); | |
$timeout(function () { | |
loggerService.log('logging something while in a timeout which should be outside initialize scope'); | |
}); | |
$timeout(function () { | |
loggerService.appendToActivity(initializeActivity, activities.testController.TIMEOUT); | |
loggerService.log('appending to the initialize activity'); | |
$timeout(function () { | |
loggerService.log('logging something while in a timeout which should be outside initialize scope'); | |
}); | |
loggerService.endActivity(activities.testController.TIMEOUT); | |
}, 2000); | |
$scope.getTasks = function () { | |
loggerService.startActivity(activities.testController.GET_TASKS_WRAPPER); | |
var getTasksAction = loggerService.startActivity(activities.testController.GET_TASKS); | |
loggerService.log('Getting tasks'); | |
$http.get('/tasks') | |
.success(function (tasks) { | |
loggerService.appendToActivity(getTasksAction, activities.testController.GET_TASKS_COMPLETE); | |
loggerService.log('tasks returned successfully', tasks); | |
$scope.tasks = tasks; | |
loggerService.endActivity(activities.testController.GET_TASKS_COMPLETE); | |
}) | |
.error(function (error) { | |
loggerService.appendToActivity(getTasksAction, activities.testController.GET_TASKS_COMPLETE); | |
loggerService.log('tasks failed', error); | |
loggerService.endActivity(activities.testController.GET_TASKS_COMPLETE); | |
}); | |
loggerService.endActivity(activities.testController.GET_TASKS); | |
loggerService.endActivity(activities.testController.GET_TASKS_WRAPPER); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment