Maybe you can choose error.service to send you log when catched an error with mail or you can add a simple db (end of day a cron jobs works daily which remove logs). Console.log output also shows you history of the error. So, you can reproduce error .
https://stackblitz.com/edit/angular-rr28hm
import { Component } from '@angular/core';
@Component({
selector: 'my-app',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
name = 'Angular';
error: string = null;
constructor() {
try {
throw new Error("hi, i am an error!");
} catch (error) {
this.error = JSON.stringify(error.stack);
console.log(this.error);
// this.http.post("url", { data: this.error }).subscribe((response) => console.log("POST: error saved to db: ", response));
}
}
}
When you parse error string you will see the error line number and history.