node-logify
v1.0.4
Published
A comprehensive logging and monitoring library for Node.js applications with Express integration
Maintainers
Readme
Node-Logify
Node-Logify is a lightweight Node.js library with Express and Pino support, designed for simple system monitoring with minimal infrastructure configuration and low resource consumption.
Installation
npm install node-logifyBasic Usage
const express = require("express");
const pino = require("pino");
const { logify } = require("node-logify");
const app = express();
// Configure Logify
const { pinoStream, expressObserver, database } = logify(app, {
users: [
{
name: "Admin User",
email: "[email protected]",
password: "admin123",
},
],
databasePath: "app-logs.db",
prefix: "/logify",
host: "localhost:3000",
});
// Use the express observer middleware
app.use(expressObserver);
// Create your logger
const logger = pino(
{ level: "info" },
pino.multistream([{ stream: process.stdout }, { stream: pinoStream }])
);
// Your application routes
app.get("/", (req, res) => {
logger.info({ userId: "123", action: "homepage_visit" });
res.json({ message: "Hello World!" });
});
app.listen(3000, () => {
console.log("Server running on http://localhost:3000");
console.log("Logify dashboard: http://localhost:3000/logify");
});📖 Configuration
LogifyConfig Interface
interface LogifyConfig {
users: User[]; // Array of users for authentication
databasePath?: string; // SQLite database file path (default: "logify.db")
prefix?: string; // URL prefix for Logify routes (default: "/logify")
host?: string; // Host for API configuration (default: "localhost:3000")
}
interface User {
name: string; // User display name
email: string; // User email (used for login)
password: string; // User password (will be hashed)
}Configuration Options
| Option | Type | Default | Description |
| -------------- | -------- | ------------------ | ------------------------------------------- |
| users | User[] | Required | Array of users for dashboard authentication |
| databasePath | string | "logify.db" | Path to SQLite database file |
| prefix | string | "/logify" | URL prefix for all Logify routes |
| host | string | "localhost:3000" | Host used in API configuration |
Dashboard Features
Logs View
- Real-time log streaming
- Advanced filtering by level, time, and content
- Log details with full context
- Export functionality
HTTP Requests
- Request/response monitoring
- Performance metrics
- Error tracking
- Status code analytics
User Management
- User authentication
- Role-based access
- Session management
- User activity tracking
System Monitoring
- CPU usage and information
- Memory consumption
- Disk space monitoring
- Load average tracking
- Real-time updates
