Val Town Logger

A simple, powerful logging system for Val Town that stores logs in SQLite and provides both a web interface and API for viewing and searching logs.

Features

  • 📝 Log any data type with automatic formatting
  • 🔍 Search logs with full-text search
  • 📊 Clean, dark-themed web interface
  • 📱 Responsive design that works on mobile and desktop
  • 🔄 Pagination and sorting options
  • 🔌 API access for programmatic log retrieval

Usage

  1. Remix this project to your account
  2. Import the log function from the logger module and use it to log any data:
import { log } from "https://esm.town/v/YOUR_USERNAME_HERE/sqlitelogs/logger.tsx"; // Log simple messages await log("User signed up"); // Log multiple values await log("User", userId, "performed action", actionType); // Log objects and complex data await log("Request data:", requestObject); await log("Error occurred:", errorObject);
  1. View logs via the HTTP val

Implementation Details

The logger uses SQLite for storage with a table structure that includes:

  • id: Unique identifier for each log entry
  • line: The formatted log message
  • ts: Timestamp when the log was created