ng-route-logger is a simple and powerful Angular library that helps you track page navigation times inside your Angular application.
Whenever a user switches from one route (page) to another, this library records:
- 📍 The new page’s URL (like
/home
,/about
) - ⏱️ How many milliseconds it took to load that page
This is super useful if you're building a fast Angular app and want to know which routes take longer to load.
✅ Simple to set up
✅ Works with Angular's built-in router
✅ Uses RxJS Observables, so you can subscribe to live logs
✅ Helpful for developers, testers, and learners
Run this command in your Angular project folder:
npm install ng-route-logger
If you're facing issues while installing (like cache or permission problems), you can force the install using:
npm install ng-route-logger --force
In your app.module.ts
, import the logger module:
import { NgRouteLoggerModule } from 'ng-route-logger';
@NgModule({
imports: [
NgRouteLoggerModule, // Add this line
...
],
})
export class AppModule {}
You can inject the logger service into any component or service like this:
import { NgRouteLoggerService } from 'ng-route-logger';
constructor(private logger: NgRouteLoggerService) {
this.logger.getLogs()
}
[
{ route: '/home', loadTime: 96.3 },
{ route: '/about', loadTime: 201.7 },
{ route: '/contact', loadTime: 87.2 }
]
-
Show a "page load time" chart for users
-
Find out which pages take longest to load
-
Log page transitions for debugging or performance testing
- ⏱️ Starts timer when route navigation begins (
NavigationStart
) - 🛑 Stops timer when navigation ends (
NavigationEnd
) - 🧾 Logs the route and time taken
- 📡 Streams the logs using RxJS Observable
Found a bug or have an idea? Create an issue or PR at:
👉 https://github.com/souravion/ng-route-logger
Here are some awesome features we plan to add in future updates:
Feature | Description |
---|---|
📊 Route Load Time Charts | Visualize navigation performance using simple charts (e.g., bar or line) |
💾 Export Logs | Export route logs as JSON or CSV files for performance audits |
🎛️ Configurable Logging Options | Enable/disable specific logs or exclude certain routes |
🧹 Auto-Cleanup | Automatically limit stored logs to the last N entries |
🔥 DevTools Panel Integration | Optional integration with browser devtools extension for real-time viewing |
🧪 Unit Test Utilities | Helpers to test routing performance in unit/e2e test suites |
🌐 Multi-Tab Session Awareness | Detect and separate logs from different browser tabs |
✨ Have an idea or feature request? Feel free to open an issue or start a discussion!
For Angular developers who want to know how fast their app really is.
-- Thanks & Regards, Sourav Halder Email: sourav.ion@gmail.com