hb-smart-logger 1.0.0 โ†’ 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +69 -45
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,67 +1,78 @@
1
- HB Smart Logger ๐Ÿš€
1
+ # HB Smart Logger ๐Ÿš€
2
2
 
3
- HB Smart Logger is a production-ready logging solution for Node.js built on top of Winston, designed to be simple to use, safe by default, and scalable for real-world applications.
3
+ **HB Smart Logger** is a **production-ready logging solution for Node.js** built on top of **Winston**, designed to be **simple to use**, **safe by default**, and **scalable for real-world applications**.
4
4
 
5
- It works out of the box with zero configuration, yet provides advanced features like daily log rotation, safe JSON logging, and structured multi-argument logging.
5
+ It works out of the box with **zero configuration**, yet provides advanced features like **daily log rotation**, **safe JSON logging**, and **structured multi-argument logging**.
6
6
 
7
- โœจ Key Benefits
7
+ ---
8
8
 
9
- โœ… Zero-Config Setup
10
- Just install and start logging โ€” no boilerplate required.
9
+ ## โœจ Key Benefits
11
10
 
12
- โœ… Safe Object Logging
13
- Handles circular JSON safely (no crashes, no [object Object]).
11
+ - โœ… **Zero-Config Setup**
12
+ Just install and start logging โ€” no boilerplate required.
14
13
 
15
- โœ… Daily Log Rotation
16
- Automatically rotates logs by day and size, with compression and retention.
14
+ - โœ… **Safe Object Logging**
15
+ Handles **circular JSON** safely (no crashes, no `[object Object]`).
17
16
 
18
- โœ… Separate & Combined Logs
19
- Keeps per-level logs (error, warn, info, debug) and a full combined log.
17
+ - โœ… **Daily Log Rotation**
18
+ Automatically rotates logs by day and size, with compression and retention.
20
19
 
21
- โœ… Multi-Argument Support
22
- Log multiple values like console.log() โ€” strings, objects, and errors.
20
+ - โœ… **Separate & Combined Logs**
21
+ Keeps **per-level logs** (`error`, `warn`, `info`, `debug`) **and** a full **combined log**.
23
22
 
24
- โœ… logger.log() Alias
25
- Drop-in replacement for console.log() โ€” routes to info level internally.
23
+ - โœ… **Multi-Argument Support**
24
+ Log multiple values like `console.log()` โ€” strings, objects, and errors.
26
25
 
27
- โœ… Error Stack Traces Included
28
- Errors automatically log full stack traces.
26
+ - โœ… **`logger.log()` Alias**
27
+ Drop-in replacement for `console.log()` โ€” routes to `info` level internally.
29
28
 
30
- โœ… Production-Ready Defaults
31
- Designed for APIs, microservices, background workers, and cron jobs.
29
+ - โœ… **Error Stack Traces Included**
30
+ Errors automatically log full stack traces.
32
31
 
33
- ๐Ÿ“ฆ Installation
34
- npm install hb-smart-logger
32
+ - โœ… **Production-Ready Defaults**
33
+ Designed for APIs, microservices, background workers, and cron jobs.
34
+
35
+ ---
35
36
 
36
- ๐Ÿš€ Quick Start
37
+ ## ๐Ÿ“ฆ Installation
38
+
39
+ ```bash
40
+ npm install hb-smart-logger
41
+ ```
42
+ ## ๐Ÿš€ Quick Start
43
+ ```bash
37
44
  const logger = require("hb-smart-logger");
38
45
 
39
46
  logger.log("Application started");
40
47
  logger.info("Server listening", { port: 3000 });
41
48
  logger.warn("Slow response", { endpoint: "/users", timeMs: 1420 });
42
49
  logger.error("Database connection failed", new Error("ECONNREFUSED"));
43
-
44
- ๐Ÿง  Smart Logging Examples
50
+ ```
51
+ ## ๐Ÿง  Smart Logging Examples
45
52
  Log multiple arguments (like console.log)
53
+ ```bash
46
54
  logger.log("User login", userId, { role: "admin" });
55
+ ```
47
56
 
48
57
  Log objects safely (no crashes)
58
+ ```bash
49
59
  const obj = {};
50
60
  obj.self = obj;
51
-
52
61
  logger.info("Circular object test", obj);
53
-
62
+ ```
54
63
  Log errors with stack trace
64
+ ```bash
55
65
  try {
56
66
  throw new Error("Something went wrong");
57
67
  } catch (err) {
58
68
  logger.error("Unhandled error", err);
59
69
  }
70
+ ```
60
71
 
61
- ๐Ÿ“ Log Output Structure
72
+ ## ๐Ÿ“ Log Output Structure
62
73
 
63
74
  HB Smart Logger automatically creates this structure:
64
-
75
+ ```bash
65
76
  logs/
66
77
  combined/
67
78
  combined-2026-01-05.log
@@ -73,14 +84,21 @@ logs/
73
84
  info-2026-01-05.log
74
85
  debug/
75
86
  debug-2026-01-05.log
87
+ ```
76
88
 
77
- What goes where?
78
- Log Level File
79
- log() / info() logs/info/ + logs/combined/
80
- warn() logs/warn/ + logs/combined/
81
- error() logs/error/ + logs/combined/
82
- debug() logs/debug/ + logs/combined/
83
- ๐Ÿ”„ Log Rotation (Built-In)
89
+ ## ๐Ÿ“‚ What Goes Where?
90
+
91
+ ## Log Level ## Files Written
92
+ **log() / info()**
93
+ logs/info/ + logs/combined/
94
+ **warn()**
95
+ logs/warn/ + logs/combined/
96
+ **error()**
97
+ logs/error/ + logs/combined/
98
+ **debug()**
99
+ logs/debug/ + logs/combined/
100
+
101
+ ## ๐Ÿ”„ Log Rotation (Built-In)
84
102
 
85
103
  ๐Ÿ“… Daily rotation
86
104
 
@@ -92,7 +110,7 @@ debug() logs/debug/ + logs/combined/
92
110
 
93
111
  No extra setup required.
94
112
 
95
- ๐Ÿงช Environment Friendly
113
+ ## ๐Ÿงช Environment Friendly
96
114
 
97
115
  Works in development, staging, and production
98
116
 
@@ -100,30 +118,36 @@ Colorized console output for local development
100
118
 
101
119
  File-based logging for production systems
102
120
 
103
- ๐Ÿ› ๏ธ Use Cases
121
+ ## ๐Ÿ› ๏ธ Use Cases
104
122
 
105
123
  โœ” REST APIs
124
+
106
125
  โœ” Express / Fastify servers
126
+
107
127
  โœ” Background workers
128
+
108
129
  โœ” Cron jobs
130
+
109
131
  โœ” Microservices
110
- โœ” Serverless (file logging disabled environments excluded)
111
132
 
112
- ๐Ÿ”ฅ Why HB Smart Logger?
113
- Feature console.log Winston HB Smart Logger
133
+ โœ” Long-running Node.js services
134
+
135
+ ## ๐Ÿ”ฅ Why HB Smart Logger?
136
+ Feature console.log Winston HB Smart Logger
114
137
  Daily rotation โŒ โŒ โœ…
115
138
  Circular JSON safe โŒ โŒ โœ…
116
139
  Per-level files โŒ โš ๏ธ โœ…
117
140
  Combined logs โŒ โš ๏ธ โœ…
118
141
  logger.log() alias โŒ โŒ โœ…
119
142
  Ready-to-use โŒ โš ๏ธ โœ…
120
- ๐Ÿ“Œ Requirements
143
+
144
+ ## ๐Ÿ“Œ Requirements
121
145
 
122
146
  Node.js >= 14
123
147
 
124
148
  CommonJS environment
125
149
 
126
- ๐Ÿงญ Roadmap
150
+ ## ๐Ÿงญ Roadmap
127
151
 
128
152
  Planned enhancements:
129
153
 
@@ -137,6 +161,6 @@ TypeScript typings
137
161
 
138
162
  Cloud logging support (AWS / GCP)
139
163
 
140
- ๐Ÿ“„ License
164
+ ## ๐Ÿ“„ License
141
165
 
142
- MIT ยฉ 2026 Hafiz Bilal
166
+ MIT ยฉ 2026 Hafiz Bilal
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hb-smart-logger",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "Production-ready Winston logger with daily rotation, safe JSON handling, and logger.log() alias",
5
5
  "main": "src/index.js",
6
6
  "publishConfig": { "access": "public" },