@hardlydifficult/logger 1.0.6 → 1.0.7

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 +11 -10
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -11,15 +11,15 @@ npm install @hardlydifficult/logger
11
11
  ## Quick Start
12
12
 
13
13
  ```typescript
14
- import { Logger, ConsolePlugin, FilePlugin, DiscordPlugin } from "@hardlydifficult/logger";
14
+ import { Logger, ConsolePlugin, FilePlugin } from "@hardlydifficult/logger";
15
15
 
16
16
  const logger = new Logger("info")
17
17
  .use(new ConsolePlugin())
18
18
  .use(new FilePlugin("./app.log"));
19
19
 
20
20
  logger.info("Server started", { port: 3000 });
21
- logger.warn("High memory usage", { usage: "85%" });
22
- logger.error("Request failed", { url: "/api/data", status: 500 });
21
+ // Output to console: [2025-01-15T10:30:00.000Z] INFO: Server started {"port":3000}
22
+ // Output to file: {"level":"info","message":"Server started","timestamp":"2025-01-15T10:30:00.000Z","context":{"port":3000}}
23
23
  ```
24
24
 
25
25
  ## Core Logger
@@ -79,9 +79,8 @@ The `formatEntry` function is also exported for custom formatting:
79
79
 
80
80
  ```typescript
81
81
  import { formatEntry } from "@hardlydifficult/logger";
82
- import type { LogEntry } from "@hardlydifficult/logger";
83
82
 
84
- const entry: LogEntry = {
83
+ const entry = {
85
84
  level: "warn",
86
85
  message: "High memory",
87
86
  timestamp: "2025-01-15T10:30:00.000Z",
@@ -132,11 +131,13 @@ logger.notify("Deployment complete");
132
131
 
133
132
  ### Behavior
134
133
 
135
- - Only `warn` and `error` log entries are sent (debug/info are filtered)
136
- - Warn entries use ⚠️ emoji; error entries use 🚨 emoji
137
- - Context is formatted as a JSON code block when present
138
- - `notify()` sends messages directly without level filtering
139
- - If `setSender` is not called, entries are silently dropped
134
+ | Behavior | Description |
135
+ |----------|-------------|
136
+ | Only `warn` and `error` log entries are sent (debug/info are filtered) | |
137
+ | Warn entries use ⚠️ emoji; error entries use 🚨 emoji | |
138
+ | Context is formatted as a JSON code block when present | |
139
+ | `notify()` sends messages directly without level filtering | |
140
+ | If `setSender` is not called, entries are silently dropped | |
140
141
 
141
142
  ## Custom Plugins
142
143
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hardlydifficult/logger",
3
- "version": "1.0.6",
3
+ "version": "1.0.7",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "files": [