inspection Svelte Themes

Inspection

Dev mode, frontend logging library for svelte with support for elimination in production.

@svelte-five/inspection

Dev mode, frontend logging library for svelte with support for elimination in production.

A small logging utility for frontend development in svelte. It prints nothing in non-dev environments and functions get eliminated during bundling for non-dev environments.

Usage

Install:

pnpm add @svelte-five/inspection

Import the relevant logging method:

import { info, debug, warn, error } from '@svelte-five/inspection'

debug('The identifier is 1')
info('Loaded local storage.')
error(new Error('Failed to fetch data.'))
warn({ msg: 'This is a warning.' })

These functions will be eliminated by your builder in production and in case your builder doesn't support auto elimination, they will produce no output based on the following condition:

const isActive = import.meta.env['VITE_SVELTE_INSPECTION'] || import.meta.env['DEV']

Contributing

If you're interested in contributing, read the CONTRIBUTING.md first, please.


Thanks for the attention 💙 Any amount of support on patreon or github will return you back as bug fixes, new features and bits and bytes.

Top categories

svelte logo

Need a Svelte website built?

Hire a professional Svelte developer today.
Loading Svelte Themes