Beautiful console output, comprehensive file logging, and extensive customization. Zero dependencies. Pure performance.
Built for modern applications with performance and developer experience in mind
50,000+ ops/sec with async file I/O and smart filtering
Color-coded levels, centered badges, and rich data display
Text, JSON, structured formats with automatic rotation
JSON output for log aggregation and analysis tools
Built-in timers, profiling, and memory tracking
Full TypeScript support with complete type definitions
npm install @millosaurs/prettylogsSee how PrettyLogs compares to other popular logging libraries
| Feature | PrettyLogs | Winston | Pino | Bunyan |
|---|---|---|---|---|
| Zero Dependencies | ||||
| Beautiful Console Output | ||||
| TypeScript Native | ||||
| File Rotation | ||||
| Performance (ops/sec) | 50,000+ | 15,000 | 60,000 | 20,000 |
| Easy Configuration | ||||
| Child Loggers |
Get started with PrettyLogs in seconds. Import the logger and start logging beautiful, structured messages.
import { logger } from "@millosaurs/prettylogs";
// Simple logging
logger.info("Application started successfully");
logger.debug("Loading configuration files");
logger.warn("Memory usage is at 85%", { usage: "85%", threshold: "80%" });
logger.error("Database connection failed", { host: "localhost", port: 5432 });
logger.success("User authentication completed", {
userId: 123,
email: "john@example.com",
});
logger.trace("Entering function validateUser()");

Create custom loggers with your preferred settings. Configure timestamps, file output, colors, and log levels.
import { createLogger } from "@millosaurs/prettylogs";
const customLogger = createLogger({
timestamps: true,
logFile: "./logs/app.log",
colorize: true,
logFormat: "json",
minLevel: "INFO",
});
customLogger.info("Custom logger message");Detailed trace information
Debug information
General information
Warning messages
Error messages
Fatal errors
Success messages
Everything you need for production-grade logging
const logger = createLogger({
logFile: "./logs/app.log",
maxFileSize: 50 * 1024 * 1024, // 50MB
maxFiles: 10,
logFormat: "json",
async: true,
bufferSize: 100,
flushInterval: 1000,
});// Simple timers
logger.time("database-query");
const result = await database.query("SELECT * FROM users");
logger.timeEnd("database-query");
// Functional timers
const stopTimer = logger.startTimer("api-request");
const response = await fetch("/api/data");
const duration = stopTimer();const logger = createLogger();
// Create namespaced logger
const userLogger = logger.child("user-service");
userLogger.info("Processing request");
// With correlation IDs
const requestLogger = logger.child(`req-${Date.now()}`);
requestLogger.info("Request started");
// Chain child loggers
const dbLogger = userLogger.child("database");// Display tables
const users = [
{ id: 1, name: "John", active: true },
{ id: 2, name: "Jane", active: false }
];
logger.table(users);
// Pretty JSON
logger.json(complexObject, "DEBUG");
// Box messages
logger.box("Server ready!");Perfect for Express, Fastify, and other Node.js web frameworks. Add request logging, error tracking, and performance monitoring.
import express from "express";
import { createLogger } from "@millosaurs/prettylogs";
const logger = createLogger({
logFile: "./logs/server.log",
timestamps: true,
logFormat: "json",
});
const app = express();
// Request logging middleware
app.use((req, res, next) => {
const requestLogger = logger.child(`req-${Date.now()}`);
requestLogger.info("Incoming request", {
method: req.method,
url: req.originalUrl,
ip: req.ip,
});
req.logger = requestLogger;
next();
});
app.get("/users", async (req, res) => {
const timer = req.logger.startTimer("fetch-users");
try {
const users = await getUsersFromDatabase();
const duration = timer();
req.logger.success("Users fetched", {
count: users.length,
duration,
});
res.json(users);
} catch (error) {
req.logger.error("Failed to fetch users", {
error: error.message,
});
res.status(500).json({ error: "Internal server error" });
}
});
const logger = createLogger({
// Optimize for production
colorize: false,
prettyPrint: false,
logFormat: "json",
async: true,
bufferSize: 500,
minLevel: "INFO",
// File management
logFile: "./logs/app.log",
maxFileSize: 100 * 1024 * 1024, // 100MB
maxFiles: 20,
});process.on("SIGTERM", async () => {
logger.info("Shutting down gracefully");
await logger.flush();
await logger.close();
process.exit(0);
});
process.on("uncaughtException", (error) => {
logger.fatal("Uncaught exception", {
message: error.message,
stack: error.stack,
});
});Install PrettyLogs now and start building better logging for your applications.