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

log-sounds

v0.0.6

Published

A powerful logging library with sound notifications

Readme

🔊 log-sound

A powerful and customizable logging library with sound notifications for Node.js applications.

npm version CI codecov License: MIT

Features

  • 🎵 Sound notifications for different log levels
  • 🎨 Customizable log levels with colors and emojis
  • ⚡ Promise-based sound playback
  • 🔗 Chainable logging methods
  • 🎮 Cross-platform support (Windows, macOS, Linux)
  • 🛠️ Extensible with custom log levels
  • 🎯 Error type-specific sounds

Installation

npm install log-sounds --save
yarn add log-sounds
pnpm add log-sounds

Quick Start

const SoundLog = require('log-sounds');
const log = new SoundLog();

// Basic logging
log.info('Application started');
log.warn('Low memory warning');
log.error('Connection failed');

// Chainable calls
log.info('Starting process')
   .debug('Step 1')
   .success('Process completed');

// Custom log levels
log.addLogLevel('http', {
  sound: 'http.mp3',
  emoji: '🌐',
  color: '\x1b[36m'
});

log.http('GET /api/users');

Documentation

Log Levels

  • error(message, error?) - ❌ For errors
  • warn(message) - ⚠️ For warnings
  • info(message) - ℹ️ For information
  • debug(message) - 🔍 For debug information
  • trace(message) - 📍 For detailed tracing
  • success(message) - ✅ For success messages
  • fatal(message, error?) - 💀 For fatal errors

Custom Log Levels

log.addLogLevel('database', {
  sound: 'db.mp3',
  emoji: '🗄️',
  color: '\x1b[35m'
});

Configuration

const log = new SoundLog({
  enabled: true,
  soundsDir: './sounds',
  defaultSound: 'default.mp3',
  logLevels: {
    // Custom sound mappings
  }
});

Browser Usage

When using in the browser, you'll need to provide sound URLs:

const log = new SoundLog({
  logLevels: {
    error: '/sounds/error.mp3',
    warn: '/sounds/warn.mp3',
    // ...
  }
});

// Usage remains the same
log.info('Application started');
log.warn('Low memory');

Note: Browser version uses the Web Audio API for sound playback.

Contributing

We welcome contributions! Please see our Contributing Guide for details.

License

MIT © [Anto]

Examples

Basic Node.js Usage

const LogSound = require('log-sounds');

const log = new LogSound({
  soundsDir: './sounds', // Directory containing your sound files
});

// Basic logging with sounds
log.info('Application started')
   .debug('Loading configuration')
   .warn('Disk space low')
   .error('Connection failed')
   .success('Operation completed')
   .fatal('Critical error');

// Error handling
try {
  throw new Error('Database connection failed');
} catch (error) {
  log.error('Failed to connect to database', error);
}

// Custom log levels
log.addLogLevel('database', {
  sound: 'db.mp3',
  emoji: '🗄️',
  color: '\x1b[35m'  // Magenta
});

log.database('Executing query...');

Express.js Middleware

const express = require('express');
const LogSound = require('log-sounds');

const app = express();
const log = new LogSound();

// Request logging middleware
app.use((req, res, next) => {
  log.info(`${req.method} ${req.url}`);
  next();
});

// Error handling middleware
app.use((err, req, res, next) => {
  log.error('Server error:', err);
  res.status(500).send('Something broke!');
});

app.get('/', (req, res) => {
  log.debug('Processing request');
  res.send('Hello World!');
});

app.listen(3000, () => {
  log.success('Server started on port 3000');
});

React Component

import LogSound from 'log-sounds';

// Initialize once
const log = new LogSound({
  logLevels: {
    error: '/sounds/error.mp3',
    warn: '/sounds/warn.mp3',
    info: '/sounds/info.mp3'
  }
});

function UserProfile() {
  useEffect(() => {
    log.info('Component mounted');

    fetchUserData()
      .then(data => {
        log.success('Data loaded successfully');
      })
      .catch(error => {
        log.error('Failed to load user data', error);
      });

    return () => {
      log.debug('Component unmounting');
    };
  }, []);

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

Next.js Global Error Handling

// pages/_app.js
import LogSound from 'log-sounds';

const log = new LogSound({
  logLevels: {
    error: '/public/sounds/error.mp3',
    warn: '/public/sounds/warn.mp3',
    info: '/public/sounds/info.mp3'
  }
});

// Global error handler
if (typeof window !== 'undefined') {
  window.onerror = (message, source, lineno, colno, error) => {
    log.error('Global error:', error);
  };
}

export default function App({ Component, pageProps }) {
  useEffect(() => {
    log.info('App initialized');
  }, []);

  return <Component {...pageProps} />;
}

Browser Usage with CDN

<!DOCTYPE html>
<html>
<head>
  <title>Log-Sounds Demo</title>
  <script src="https://unpkg.com/log-sounds"></script>
</head>
<body>
  <button onclick="testLogs()">Test Logs</button>

  <script>
    const log = new LogSound({
      logLevels: {
        error: '/sounds/error.mp3',
        warn: '/sounds/warn.mp3',
        info: '/sounds/info.mp3'
      }
    });

    function testLogs() {
      log.info('Starting test')
         .warn('This is a warning')
         .error('This is an error')
         .success('Test completed');
    }
  </script>
</body>
</html>

Custom Error Types

const LogSound = require('log-sounds');
const log = new LogSound();

// Define custom errors
class DatabaseError extends Error {
  constructor(message) {
    super(message);
    this.name = 'DatabaseError';
  }
}

class ValidationError extends Error {
  constructor(message) {
    super(message);
    this.name = 'ValidationError';
  }
}

// Map custom errors to specific sounds
log.mapErrorToSound('DatabaseError', 'db-error.mp3');
log.mapErrorToSound('ValidationError', 'validation-error.mp3');

// Usage
try {
  throw new DatabaseError('Connection failed');
} catch (error) {
  log.error('Database operation failed', error);
}