useLogger

Log component lifecycle events.

https://www.shaktools.com/shak-hooks
Utility

API Reference

Installation

terminal
pnpm add @shak-hooks/usehooks
import.ts
import { useLogger } from "@shak-hooks/usehooks";
Source: packages/react/src/useLogger.ts

Signature

signature.ts
export function useLogger(name: string, ...rest: any[])

Parameters

NameTypeOptionalDefault
namestringNo-
restany[]No-

Returns

unknown

Implementation

use-logger.ts
1import { useEffect } from "react";
2
3export function useLogger(name: string, ...rest: any[]) {
4 useEffect(() => {
5 console.log(`${name} mounted`, ...rest);
6 return () => console.log(`${name} unmounted`);
7 }, []);
8
9 useEffect(() => {
10 console.log(`${name} updated`, ...rest);
11 });
12}

Advertisement

Google Ads

Usage

example.tsx
1import { useLogger } from "@shak-hooks/usehooks";
2
3const result = useLogger("...", undefined);
4// result: unknown
5// Use values directly (React state).

Let‘s do great work together

Empowering creators with free, high-performance AI, SEO, and developer tools. Join thousands of users optimizing their workflow with Shak-Tools.

Tools10+ Free
UsersGlobal

Stay in the loop

Join our newsletter for the latest AI tools and updates.

ShakTools
© 2025 Shaktools. All Rights Reserved.Privacy Policy