@stonyx/logs 1.0.1-alpha.24 → 1.0.1-alpha.25

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 +15 -0
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -197,6 +197,21 @@ Every other code — including `EACCES`, `EPERM` and `EROFS` — rejects immedia
197
197
  because `mkdir` on an existing directory is a successful no-op: it cannot change a permission bit or
198
198
  a read-only mount, so a retry could only ever repeat the same failure at twice the syscall cost.
199
199
 
200
+ ##### The directory cache
201
+
202
+ To keep the write path free of repeated `mkdir` calls, each `Log` instance exposes a
203
+ `directoryCache` field: a `Map` keyed on the resolved directory (not on the target filename), whose
204
+ values are the in-flight or settled `mkdir` promises. It is **instance-scoped, not module-scoped** —
205
+ two `Log` instances pointing at the same directory each call `mkdir` once. Entries are **never
206
+ evicted on success**, so a directory is created at most once per instance for the process lifetime;
207
+ entries are dropped only when the `mkdir` rejects, or when a write fails with a retryable code and
208
+ the directory is recreated.
209
+
210
+ It is public only because the class carries an index signature, and it is not part of the supported
211
+ API: treat it as read-only, since mutating it corrupts the write path. Note also that the name is
212
+ reserved — a log type called `directoryCache` is silently skipped rather than overwriting the cache,
213
+ so no convenience method is generated for it.
214
+
200
215
  ### The Debug Method
201
216
 
202
217
  **Log** allows for the `log.debug()` method to be overridden by a color setting. However, by default we do not define a color for debug and debug is handled differently. For console logging, all **debug** does is output the following:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stonyx/logs",
3
- "version": "1.0.1-alpha.24",
3
+ "version": "1.0.1-alpha.25",
4
4
  "description": "Simplified logging for node applications",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",