Loupe - Log - Monitor - Resolve
Loupe / Developer's Guide / For JavaScript / Angular / Developer's Reference - Angular - Logging
In This Topic
    Developer's Reference - Angular - Logging
    In This Topic

    The Loupe Agent for Angular lets you write log messages from any Angular component.  First, you'll need to add the Loupe Agent for Angular to your application.  Once that's done, you can inject it into any component like this:

    import { LoupeService } from '@gibraltarsoftware/loupe-angular';
    @Component({
      selector: 'app-first',
      templateUrl: './first.component.html',
      styleUrls: ['./first.component.css']
    })
    export class FirstComponent implements OnInit {
      constructor(
        private readonly LoupeService: LoupeService
      ) { }
      ngOnInit(): void {
        this.loupe.information(
          'JavaScript', 'Component Initialization', 'The first component is initializing',
          null, null, null, null
        );
      }
    }
    

    In the example above, an information log message is recorded within the OnInit event of the component.

    Once you've injected the loupe agent, you can write log messages at will.  For complete details, see Developer's Reference - JavaScript - Logging.

    See Also