semantic-logs
v1.1.1
Published
A simple and feature rich logging framework for node.js
Maintainers
Readme
semantic-logs
A lightweight utility library for logging in node.js, built with TypeScript and powered by boxen and chalk.
🚀 Features
- 🔍 Simple
log()function to semantically log. - ⚡ Lightweight and fast – Only 2 dependencies.
- 🧩 Easily extensible for custom logging rules with
createLogger().
⬇️ Installation
Install semantic-logs with npm
md my-app
cd my-app
npm install semantic-logs💿 Usage/Examples
import { Logger } from 'semantic-logs';
const logger = new Logger();
logger.log('Hello World');🧰 Functions/Methods
Usage and parameter list of all available functions
log()
Logs the passed message with provided options.
import { Logger } from 'semantic-logs';
const logger = new Logger();
logger.log('warn', { level: 'warn' });| Parameter | Type | Required | Description |
| ----------- | ------------ | -------- | --------------------------------- |
| Message | any | true | The input to emit log on console. |
| Options | LogOptions | false | Options for log. |
createLogger()
Create a return a logging function with defined options.
import { Logger } from 'semantic-logs';
const logger = new Logger();
const options: LogOptions = {
level: 'info',
title: 'System Update',
color: 'cyan',
borderStyle: 'bold',
padding: 1
};
logger.createLogger(options);| Parameter | Type | Required | Description |
| --------- | ------------ | -------- | ---------------- |
| Options | LogOptions | false | Options for log. |
🛠️ LogOptions Specification
| Property | Type | Description |
| :---------------- | :-------------------- | :------------------------------------------------------------------ |
| level | LogLevel | Defines the severity level of the log entry. |
| title | string | The heading text displayed for the log. |
| color | ForegroundColorName | Sets the color for the primary text. |
| borderColor | ForegroundColorName | Sets the color for the box/container border. |
| icon | string | An optional icon or emoji prefix. |
| textAlignment | Alignment | (Readonly) Horizontal alignment of the main text. |
| padding | number | (Readonly) Internal spacing within the log container. |
| margin | number | (Readonly) External spacing around the log container. |
| titleAlignment | Alignment | (Readonly) Horizontal alignment of the title. |
| backgroundColor | BackgroundColorName | (Readonly) The background color behind the text. |
| borderStyle | keyof Boxes | (Readonly) The line style of the border (e.g., 'single', 'double'). |
🤝 Contribution
Contributions are welcome and appreciated! If you have suggestions for improvements, feel free to open an issue or submit a pull request. Let’s make semantic-logs better together! 🐝✨
🚀 Run Locally
Clone the project
git clone https://github.com/sandeep-shome/semantic-logs.gitGo to the project directory
cd semantic-logs🔧 Install dependencies
npm installYou can now explore and modify the package as per your needs.
📦 Build the Project
npm run build🧪 Running Tests
Follow the steps below to run and verify the functionality of the CLI and validation logic.
npm run test🔧 Built With
- TypeScript – Strongly typed language for scalable JavaScript development
- Jest – Fast unit testing framework with great DX
- tsup – Super-fast TypeScript bundler powered by esbuild
📎Appendix
semantic-logs is an open-source project developed and maintained by a solo developer with a passion for clean code, creativity, and community-driven tools.
You're welcome to explore, use, and contribute to the project! Whether it's fixing a bug, suggesting a feature, or improving the documentation — your contributions are highly appreciated.
Feel free to check out the GitHub repository and join in making this project better for everyone. Let's build something fun together! 💡
👨💻 Authors
📄 License
🙋♂️ Support
For support, email [email protected]
