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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@cp949/web-logger-react

v1.0.6

Published

React hooks for @cp949/web-logger

Readme

@cp949/web-logger-react

A small React adapter that creates stable WebLogger instances with useWebLogger.

npm package · 한국어 · monorepo

Installation

pnpm add @cp949/web-logger @cp949/web-logger-react

Peer requirements:

  • React 18 or 19
  • @cp949/web-logger ^1.0.4

Usage

import { useEffect } from 'react';
import { useWebLogger } from '@cp949/web-logger-react';

function UserList() {
  const logger = useWebLogger('[UserList]');

  useEffect(() => {
    logger.info('Users loaded', { count: 3 });
  }, [logger]);

  return <div>User list</div>;
}

The returned logger is memoized. It remains the same object across renders until the prefix changes.

Without a prefix, the hook returns the shared webLogger instance from @cp949/web-logger:

function SaveButton() {
  const logger = useWebLogger();

  return <button onClick={() => logger.info('Save clicked')}>Save</button>;
}

All instances use the core package's shared log level and sensitive-data configuration. See the @cp949/web-logger README for level control, masking, and the full logger API.

Next.js

useWebLogger is a React hook, so call it from a Client Component:

'use client';

import { useEffect } from 'react';
import { useWebLogger } from '@cp949/web-logger-react';

export function AccountPanel() {
  const logger = useWebLogger('[AccountPanel]');

  useEffect(() => {
    logger.debug('Panel mounted');
  }, [logger]);

  return <section>Account</section>;
}

The core package can be imported during server rendering, but this hook is for React component code. For durable server logs, use a server logger with the transports and persistence your application requires.

API

useWebLogger(prefix?: string): WebLogger

| Parameter | Type | Description | | --- | --- | --- | | prefix | string \| undefined | Label prepended to log output. Omit it to use the shared logger. |

The package also re-exports the WebLogger and LogLevel TypeScript types from @cp949/web-logger.

Development

From the monorepo root:

pnpm --filter @cp949/web-logger-react test
pnpm --filter @cp949/web-logger-react typecheck
pnpm --filter @cp949/web-logger-react build

Coverage thresholds are configured at 80% for statements, functions, and lines, and 75% for branches.

License

MIT