1.0.3 • Published 10 months ago
@alihussnain101/core_logger v1.0.3
Rust Node Logger
A high-performance Node.js logger implemented in Rust using Neon bindings.
Installation
npm install @alihussnain101/core_loggerPrerequisites
- Node.js >=14.0.0
- Rust toolchain (for compilation)
- cargo (Rust package manager)
Usage
const Logger = require("@alihussnain101/core_logger");
// Initialize logger
const logger = new Logger({
logPath: "app.log",
minLevel: "INFO",
metadata: {
service: "user-service",
environment: "production",
},
});
// Log messages
logger.info("Server started", { port: 3000 });
logger.error("Database connection failed", { retryCount: 3 });
logger.debug("Processing request", { requestId: "123" });Configuration Options
| Option | Type | Default | Description |
|---|---|---|---|
| logPath | string | 'app.log' | Path to the log file |
| minLevel | string | 'INFO' | Minimum log level ('ERROR', 'WARN', 'INFO', 'DEBUG', 'TRACE') |
| metadata | object | {} | Default metadata to include in all log entries |
Log Levels
- ERROR: Error conditions
- WARN: Warning conditions
- INFO: Informational messages
- DEBUG: Debug messages
- TRACE: Trace messages
Performance
This logger is implemented in Rust for high performance. It uses asynchronous I/O and efficient memory management.