
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
pretty-js-log
Advanced tools
A light logging package for Node.js and Bun applications. Features file logging and beautiful console output.
A lightweight and colorful logging package for Node.js and Bun applications. Makes your console output beautiful and saves logs to files!
# Using npm
npm install pretty-js-log
# Using bun
bun install pretty-js-log
const { logFactory } = require('pretty-js-log');
// Create a basic logger
const logger = logFactory({});
// Log some messages
logger('Hello World');
logger.info('This is an info message');
logger.warn('Warning! Something needs attention');
logger.error('Oops! Something went wrong');
logger.debug('Debug information');

const logger = logFactory({
path: './logs/app.log', // Logs will be saved here
id: process.pid // Add process ID to logs
});
logger('This will be saved to the file too!');
const data = {
user: 'john',
age: 25
};
logger('User data:', data); // Objects are automatically formatted
Automatically prefix your log files with dates to organize them by day:
// Using default date format (YYYYMMDD)
const logger = logFactory({
path: './logs/app.log',
dayBasedFileLog: true
});
// Creates: ./logs/20251020-app.log
// With custom date format
const logger2 = logFactory({
path: './logs/app.log',
dayBasedFileLog: true,
dateFormat: 'YYYY-MM-DD'
});
// Creates: ./logs/2025-10-20-app.log
// Hourly log files
const logger3 = logFactory({
path: './logs/app.log',
dayBasedFileLog: true,
dateFormat: 'YYYYMMDD-HH'
});
// Creates: ./logs/20251020-14-app.log (for 2 PM)
If you want to write logs only to file without console output, use the toStdout option:
const logger = logFactory({
path: './logs/app.log',
toStdout: false // Logs will only be written to file
});
logger('This will only appear in the log file');
logger.info('Silent logging to file');
You can dynamically update the logger ID after creation using the id method:
const logger = logFactory({
id: 'initial-id'
});
logger('First log with initial ID');
logger.id('new-id');
logger('This log will show the new ID');
When you run your logs, they'll look something like this in the console:
[2024-03-15 10:30:45] - [id:1234] - Hello World
[2024-03-15 10:30:46] - [id:1234] - This is an info message
[2024-03-15 10:30:47] - [id:1234] - Warning! Something needs attention
Feel free to open issues and submit PRs! This is an open-source project and we welcome contributions.
MIT License - feel free to use this in your projects!
Belguinan Noureddine
GitHub: https://github.com/belguinan
FAQs
A light logging package for Node.js and Bun applications. Features file logging and beautiful console output.
We found that pretty-js-log demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.