npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

frontend-logger-advanced

v1.2.0

Published

Comprehensive frontend logging system with dead click detection, rage click detection, framework integrations (React/Solid), and cloud streaming support

Downloads

24

Readme

Frontend Logger

npm version License: MIT TypeScript

Comprehensive frontend logging with dead click detection, rage click detection, React/Solid integrations, and cloud streaming.

✨ Features

🎯 Dead Click Detection • 🔥 Rage Click Detection • ⚛️ React Integration • 🧩 Solid JS Integration • ☁️ Azure Event Hubs • 📁 File Export • 🔧 TypeScript Support • 🚀 Performance Optimized

📦 Installation

npm install frontend-logger-advanced

🚀 Quick Start

import { initLogging } from 'frontend-logger-advanced';

// Basic usage
const logger = await initLogging({
  config: {
    features: { deadClickDetection: true, rageClickDetection: true },
    logging: { level: 'INFO' }
  }
});

logger.info('User action', { action: 'button_click' });
logger.custom('purchase', { productId: '123', amount: 99.99 });

With Config File

import { quickStart } from 'frontend-logger-advanced';
const logger = await quickStart('/config/logger.json');

⚛️ React Integration

import { LoggerProvider, useLogger } from 'frontend-logger-advanced/react';

function App() {
  return (
    <LoggerProvider config={{ features: { reactSupport: true } }}>
      <MyComponent />
    </LoggerProvider>
  );
}

function MyComponent() {
  const logger = useLogger();
  const handleClick = () => logger?.info('Button clicked');
  return <button onClick={handleClick}>Click me</button>;
}

🧩 Solid JS Integration

import { createLoggerSignal } from 'frontend-logger-advanced/solid';

function App() {
  const { logger, isInitialized } = createLoggerSignal();
  const handleClick = () => logger()?.custom('button_click');
  
  return (
    <Show when={isInitialized()}>
      <button onClick={handleClick}>Click Me</button>
    </Show>
  );
}

📋 Log Object Format

interface LogEntry {
  id: string;                    // "log_1691756400000_abc123"
  type: 'custom' | 'dead_click' | 'rage_click' | 'error';
  level: 'DEBUG' | 'INFO' | 'WARN' | 'ERROR';
  timestamp: string;             // "2025-08-11T12:00:00.000Z"
  message?: string;
  details: Record<string, any>;
  metadata: {
    sessionId: string;
    url: string;
    browserInfo?: { name: string; version: string; platform: string; };
  };
}

🔧 Configuration

{
  "features": {
    "customLogs": true,
    "deadClickDetection": true,
    "rageClickDetection": true,
    "localLogFile": true,
    "eventHub": false
  },
  "logging": {
    "level": "INFO",
    "endpoint": "https://api.example.com/logs",
    "batchSize": 50,
    "batchInterval": 5000
  },
  "deadClick": { "timeout": 300, "excludeSelectors": [".loading"] },
  "rageClick": { "threshold": 3, "timeWindow": 1000 }
}

📖 Documentation

📊 Log Levels & Custom Events

// Standard logging
logger.debug('Debug info', { state: currentState });
logger.info('User logged in', { userId: '123' });
logger.warn('Deprecated API used');
logger.error('API call failed', { error: 'Network timeout' });

// Custom events
logger.custom('product_view', { productId: 'ABC123', price: 299.99 });
logger.custom('add_to_cart', { productId: 'ABC123', quantity: 2 });
logger.custom('checkout_complete', { orderId: 'ORD456', total: 599.98 });

🎯 Click Detection

  • Dead Clicks: Automatically detect clicks on non-interactive elements
  • Rage Clicks: Identify rapid repeated clicks indicating user frustration
  • Configurable: Custom selectors, timeouts, and thresholds
  • Smart Detection: Excludes loading states, carousels, sliders

☁️ Cloud Integration

// Azure Event Hubs
const logger = await initLogging({
  config: {
    features: { eventHub: true },
    eventHub: {
      connectionString: "Endpoint=sb://...",
      eventHubName: "frontend-logs",
      partitionKey: "sessionId"
    }
  }
});

// HTTP Endpoint
const logger = await initLogging({
  config: {
    logging: { endpoint: 'https://api.example.com/logs' }
  }
});

📈 Performance

  • < 1ms per log entry
  • Memory efficient with automatic queue management
  • Non-blocking passive event listeners
  • Tree-shakeable exports
  • Optimized bundling with minification

🔒 Security

  • Data sanitization prevents XSS
  • HTTPS endpoints only
  • SAS token support for Azure
  • No automatic PII collection

📄 License

MIT © Rushikesh Thosar


GitHub RepositoryIssuesnpm Package