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

losi-logger

v1.0.0

Published

A clean and minimal TypeScript logger

Readme

🔥 losi-logger

A lightweight, clean, and TypeScript-ready logger for both Node.js and React (browser) apps. Color-coded logs, timestamped output, adjustable log levels — simple, elegant, and developer-friendly.


✨ Features

✅ Written in TypeScript ✅ Works in Node.js and React/browser ✅ Color-coded & timestamped logs ✅ Adjustable log level (debug, info, warn, error) ✅ Lightweight — only 1 dependency (Chalk) ✅ Simple, clean API


📦 Installation

From npm

npm install losi-logger

🧩 Quick Start

🔹 Import the Logger

You can import it as a class and create your own logger instance.

import { Logger } from "losi-logger";

const logger = new Logger({
  level: "debug",
  showTimestamp: true,
});

⚙️ Configuration Options

| Option | Type | Default | Description | | | | | --------------- | --------- | ------- | -------------------------------------------------- | -------- | -------- | --------------------------------------------------------- | | level | "debug" | "info" | "warn" | "error" | "info" | Minimum log level to show. Lower levels are filtered out. | | showTimestamp | boolean | true | Whether to display timestamps before log messages. | | | |

Example:

const logger = new Logger({
  level: "warn",
  showTimestamp: false,
});

Logs below “warn” (like info or debug) will not appear.


🚀 Example Usage

🟦 Node.js Example

index.js

import { Logger } from "losi-logger";

const logger = new Logger({
  level: "debug",
  showTimestamp: true,
});

logger.info("Server started successfully!");
logger.warn("Low memory warning...");
logger.error("Something went wrong!");
logger.debug("Debugging details here...");

🧾 Terminal Output (with colors):

[2025-10-22T08:12:31.342Z] INFO: Server started successfully!
[2025-10-22T08:12:31.345Z] WARN: Low memory warning...
[2025-10-22T08:12:35.100Z] ERROR: Something went wrong!
[2025-10-22T08:12:35.102Z] DEBUG: Debugging details here...

🟨 React JSX Example

Works perfectly with Create React App, Vite, or Next.js.

src/logger.js

import { Logger } from "losi-logger";

const logger = new Logger({
  level: "debug",
  showTimestamp: true,
});

export default logger;

src/App.jsx

import React, { useEffect } from "react";
import logger from "./logger";

function App() {
  useEffect(() => {
    logger.info("App mounted successfully 🚀");
    logger.debug("Component initialized");
  }, []);

  const handleClick = () => {
    logger.warn("Button clicked!");
    logger.error("Example error message 😅");
  };

  return (
    <div style={{ padding: 20 }}>
      <h1>losi Logger Demo</h1>
      <button onClick={handleClick}>Click Me</button>
    </div>
  );
}

export default App;

🧾 Browser Console Output:

[2025-10-22T08:12:31.342Z] INFO: App mounted successfully 🚀
[2025-10-22T08:12:31.345Z] DEBUG: Component initialized
[2025-10-22T08:12:35.100Z] WARN: Button clicked!
[2025-10-22T08:12:35.102Z] ERROR: Example error message 😅

Each log is automatically color-coded using CSS colors in the browser console.


🧠 Log Levels Explained

| Level | Description | Output Color | | ------- | ------------------------- | ------------ | | debug | Development-only messages | Magenta | | info | General information | Blue | | warn | Non-breaking warnings | Yellow | | error | Critical issues | Red |


🧱 Dual Environment Support

losi-logger automatically detects where it’s running:

  • 🖥 Node.js → Uses Chalk for terminal colors
  • 🌐 Browser (React) → Uses console.log with CSS color styling

No configuration needed — it just works!


🪄 API Summary

logger.info(message: any)
logger.warn(message: any)
logger.error(message: any)
logger.debug(message: any)

Each log automatically includes:

  • A timestamp (optional)
  • Log level tag
  • Colorized output (terminal or browser)

📄 License

MIT © 2025 Made with ❤️ by Losi


🌟 Summary

| Feature | Description | | ------------------- | ------------------------------- | | 🧠 TypeScript | Built for modern JS/TS projects | | 🌈 Colorized logs | Easy to read output | | 🕐 Timestamped | Automatic ISO timestamps | | ⚙️ Configurable | Control verbosity & timestamps | | 🪶 Lightweight | Only Chalk dependency | | 💻 Works everywhere | Node + React/browser compatible |

Enjoy clean logging with 🪶 losi-logger!