The code I posted was for AngularJS.   Note that the title for this thread
is misleading.

[AngularJS] Angular 7 Logging Service

AngularJS and Angular are 2 different animals.

On Mon, Jan 7, 2019 at 2:11 PM Scott Logsdon <sc...@ser.vi> wrote:

> Suresh,
>
> You could use a service similar to the following which will report client
> side stack trace.
>
> export default angular
>>  .module('app.services.exceptionOverride', [])
>>  .factory('$exceptionHandler', function($injector) {
>>     return function(exception, cause) {
>>         var errUrl = "your/api/endpoint/report_js_error";
>>         StackTrace.fromError(exception)
>>         .then(function(stackframes) {
>>             var stringifiedStack = stackframes.map(function(sf) {
>>                 return sf.toString();
>>             }).join('\n');
>>             var $http = $injector.get("$http");
>>             var payload = { stackTrace: stringifiedStack, errorMessage:
>> exception.message, app: 'my_app' };
>>             $http.post(errUrl , payload)
>>             .then(function (response) {
>>                 console.log("success")
>>                 console.log(response);
>>             }, function (response) {
>>                 console.log("fail");
>>                 console.log(response);
>>             });
>>         })
>>         .catch(function(err){
>>             console.log(err.message);
>>         });
>>         throw exception;
>>     };
>>  })
>>  .name;
>
>
> There is a fairly good article here
> http://johnliu.net/blog/2015/8/angularjs-logging-client-side-stack-trace
>
> Hope this helps.
>
>
>
>
>
> On Mon, Jan 7, 2019 at 9:14 AM Tito <yosi...@gmail.com> wrote:
>
>> It is not really angular 7 logging service. I think most accurate
>> description is angular 7 that makes use logging service api
>>
>> Pretty much any version of angular can consume any service. But that
>> said, if you want a logging service it is just a matter of implementing it
>> on you actual rest api service either to log to log files on disk or to a
>> backend
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Angular and AngularJS discussion" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to angular+unsubscr...@googlegroups.com.
>> To post to this group, send email to angular@googlegroups.com.
>> Visit this group at https://groups.google.com/group/angular.
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to angular+unsubscr...@googlegroups.com.
To post to this group, send email to angular@googlegroups.com.
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to