1.0.0 • Published 1 year ago

@onurege3467/live-logger v1.0.0

Weekly downloads
-
License
MIT
Repository
-
Last release
1 year ago

Live Logger

Real-time logging visualization tool that displays console logs in a web interface.

Features

  • Captures logs from Express, Node.js applications or shell scripts
  • Displays logs in a real-time web interface (similar to DevTools)
  • Works locally on localhost:9000/logs
  • Color-coded log levels
  • Timestamp tracking
  • Log filtering by level
  • Search functionality

Installation

npm install @onurege3467/live-logger

Usage

As a module in your Node.js/Express application

const { logger } = require('@onurege3467/live-logger');

// Start the logger server
logger.start();

// Log messages
logger.info('Server started');
logger.warn('Warning message');
logger.error('Error occurred');
logger.debug('Debug information');

As a CLI tool to capture shell script logs

# Install globally
npm install -g @onurege3467/live-logger

# Run your script and pipe the output to live-logger
your-script.sh | live-logger

# Or directly use it with a command
live-logger "npm start"

Web Interface

Once the logger is running, open your browser and go to:

http://localhost:9000/logs

The web interface allows you to:

  • View real-time logs
  • Filter logs by level (info, warn, error, debug)
  • Search for specific text in logs
  • Clear logs
  • Pause/resume log streaming

API

logger.start(options)

Starts the logger server with the given options.

logger.start({
  port: 9000,            // Port for the web interface (default: 9000)
  silent: false,         // Whether to silence console output (default: false)
  logToFile: false,      // Whether to save logs to a file (default: false)
  logFilePath: './logs'  // Path to save log files (default: './logs')
});

Log Methods

  • logger.info(message, ...args) - Log info message
  • logger.warn(message, ...args) - Log warning message
  • logger.error(message, ...args) - Log error message
  • logger.debug(message, ...args) - Log debug message

License

MIT