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 🙏

© 2025 – Pkg Stats / Ryan Hefner

printly

v0.0.1

Published

A flexible logging library for JavaScript/TypeScript that allows customizable log levels and enhanced logging features.

Readme

Printly - A Conditional Console Wrapper for Structured Logging

npm version
License
Build Status

🚀 What is Printly?

Printly is not just another logger—it is a smart wrapper around the console object that allows you to print messages conditionally, structured, and with additional configurations like timestamps, colors, environment-based output, and caller information.

It is designed for developers who need better control over console logs without using heavyweight logging libraries.


🎯 Key Features

Conditional Logging – Only log messages if a condition is met.
Pre-configured Logging – Create custom print instances with default settings.
Enhanced Output Formatting – Supports timestamps, environment tags, caller info, and custom styles.
Lightweight & Dependency-Free – No unnecessary dependencies, just an enhanced console.
Supports Log Levelslog, warn, error, info, and debug with custom styling.


📚 Installation

npm install printly
# or
yarn add printly

🚀 Basic Usage

1️⃣ Simple Logging

import { print } from "printly";

print("Hello, world!");
print.log("This is a log message.");
print.warn("Warning! Something might be wrong.");
print.error("An error occurred!");
print.info("Informational message.");

2️⃣ Conditional Logging

const isDebugMode = true;
print.if(isDebugMode, "Debugging mode is ON");

3️⃣ Customizing Output

print.log("Styled log", {
  options: {
    color: "blue",
    showTimestamp: true,
    showCallerInfo: true,
  },
});

🛠️ Advanced Usage

🔹 Pre-Configured Logging with createPrint

Want a custom print instance with default options? Use createPrint:

import { createPrint } from "printly";

const devPrint = createPrint({
  environment: "development",
  options: { showTimestamp: true, color: "cyan" },
});

devPrint.log("This is a development log"); // Always logs with timestamp & cyan color

const prodPrint = createPrint({
  environment: "production",
  options: { showTimestamp: false, color: "red" },
});

prodPrint.error("Critical error in production!"); // Logs only in production mode

🏷️ API Reference

🖨️ print

print(...args: any[]): void

Logs a message using the default log level.

🔹 print.log

print.log(...args: any[]): void

Logs a message at the log level.

⚠️ print.warn

print.warn(...args: any[]): void

Logs a message at the warning level, with yellow styling.

❌ print.error

print.error(...args: any[]): void

Logs a message at the error level, with red styling.

ℹ️ print.info

print.info(...args: any[]): void

Logs a message at the info level, with blue styling.

🐞 print.debug

print.debug(...args: any[]): void

Logs a message at the debug level, with red styling.

⏳ print.if

print.if(condition: boolean, ...args: any[]): void

Logs a message only if the condition is true.

🛠️ createPrint

createPrint(defaultConfig: Partial<PrintProps>): PrintInstance

Creates a pre-configured print instance with default settings.


💡 Why Use Printly?

No More Messy console.log Statements – Keep logs structured and meaningful.
Lightweight & Minimalistic – No dependencies, super easy to use.
More Control Over Logging – Customize when and how messages are logged.
Perfect for Development & Debugging – Works seamlessly in both dev and prod environments.


🐜 License

This project is licensed under the MIT License.


🙌 Contributing

Contributions are welcome! Feel free to submit issues or pull requests on GitHub.


Support & Feedback

If you like Printly, consider starring the repo and sharing it with others. For feedback, open an issue or reach out via email.


📢 Print Smarter, Not Harder.
🚀 Start using Printly today!