Angularjs $log service Example--AngularJS $log(after running open Inspect elements(console))

preview_player
Показать описание
AngularJS includes a logging service called $log, which logs the messages to the client browser's console.

The $log service includes different methods to handle the log for error, information, warning or debug information.
It can be useful in debugging and auditing.

$log in AngularJS
Although this is fine while debugging your application, yet it is not a best practice for production environment.
As AngularJS is all about services, it is a better idea to create a logging service that you can call from other services
but you can also modify the service later to record messages to store them in local storage or a database table
via the Web API.

Some methods that we will use for logging in AngularJS $log are:

log(); to write a log message
info(); to write an information message
warn(); to write a warning message
error(); to write an error message
debug(); to write a debug message