@little-nebulae/log 0.2.0 → 0.3.0

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.
package/dist/index.d.ts CHANGED
@@ -1,17 +1,16 @@
1
- import { z } from "zod";
2
1
  import { Tagged } from "type-fest";
3
- export declare const LOG_LEVEL: {
2
+ import { z } from "zod";
3
+ export declare const LOG_LEVEL_ENUM: {
4
4
  readonly INFO: "info";
5
5
  readonly WARN: "warn";
6
6
  readonly ERROR: "error";
7
7
  readonly FATAL: "fatal";
8
8
  };
9
- export declare const LOG_LEVELS: readonly ["info", "warn", "error", "fatal"];
10
- export declare const DEFAULT_MINIMUM_LOG_LEVEL: {
9
+ export declare const DEFAULT_MINIMUM_LOG_LEVEL_ENUM: {
11
10
  readonly DEVELOPMENT: "info";
12
11
  readonly PRODUCTION: "warn";
13
12
  };
14
- export declare const DEFAULT_LOG_DIR_NAME: {
13
+ export declare const DEFAULT_LOG_DIR_NAME_ENUM: {
15
14
  readonly ROOT: "logs";
16
15
  readonly MAIN: "main-thread";
17
16
  readonly WORKER: "worker-threads";
@@ -103,10 +102,10 @@ export declare function createLogSchema<Name extends string, InputSchema extends
103
102
  operations: OperationsSchema;
104
103
  id: z.ZodPipe<z.ZodUUID, z.ZodTransform<LogId, string>>;
105
104
  level: z.ZodEnum<{
106
- error: "error";
107
- fatal: "fatal";
108
- info: "info";
109
- warn: "warn";
105
+ readonly INFO: "info";
106
+ readonly WARN: "warn";
107
+ readonly ERROR: "error";
108
+ readonly FATAL: "fatal";
110
109
  }>;
111
110
  context: z.ZodObject<{
112
111
  who: z.ZodString;
@@ -117,10 +116,10 @@ export declare function createLogSchema<Name extends string, InputSchema extends
117
116
  }, z.core.$strip>;
118
117
  export type Log<Name extends string = string, InputSchema extends z.ZodType = z.ZodType, OutputSchema extends z.ZodType = z.ZodType, OperationsSchema extends SequentialOperationsTuple = SequentialOperationsTuple> = z.infer<ReturnType<typeof createLogSchema<Name, InputSchema, OutputSchema, OperationsSchema>>>;
119
118
  export declare const LogLevelSchema: z.ZodEnum<{
120
- error: "error";
121
- fatal: "fatal";
122
- info: "info";
123
- warn: "warn";
119
+ readonly INFO: "info";
120
+ readonly WARN: "warn";
121
+ readonly ERROR: "error";
122
+ readonly FATAL: "fatal";
124
123
  }>;
125
124
  export type LogLevel = z.infer<typeof LogLevelSchema>;
126
125
  export declare const LogContextSchema: z.ZodObject<{
@@ -131,10 +130,10 @@ export declare const LogContextSchema: z.ZodObject<{
131
130
  }, z.core.$strip>;
132
131
  export type LogContext = z.infer<typeof LogContextSchema>;
133
132
  export declare abstract class Logger {
134
- abstract [LOG_LEVEL.INFO]<TLog extends Log>(log: TLog, ...rest: unknown[]): void;
135
- abstract [LOG_LEVEL.WARN]<TLog extends Log>(log: TLog, ...rest: unknown[]): void;
136
- abstract [LOG_LEVEL.ERROR]<TLog extends Log>(log: TLog, ...rest: unknown[]): void;
137
- abstract [LOG_LEVEL.FATAL]<TLog extends Log>(log: TLog, ...rest: unknown[]): void;
133
+ abstract [LOG_LEVEL_ENUM.INFO]<TLog extends Log>(log: TLog, ...rest: unknown[]): void;
134
+ abstract [LOG_LEVEL_ENUM.WARN]<TLog extends Log>(log: TLog, ...rest: unknown[]): void;
135
+ abstract [LOG_LEVEL_ENUM.ERROR]<TLog extends Log>(log: TLog, ...rest: unknown[]): void;
136
+ abstract [LOG_LEVEL_ENUM.FATAL]<TLog extends Log>(log: TLog, ...rest: unknown[]): void;
138
137
  }
139
138
  interface ComposeLogMessageParams extends LogContext {
140
139
  level: LogLevel;
package/dist/index.js CHANGED
@@ -1,23 +1,17 @@
1
1
  import { NonEmptyStringSchema, PositiveIntegerSchema } from "@little-nebulae/zod-schemas";
2
2
  import { z } from "zod";
3
3
  // src/constants.ts
4
- const LOG_LEVEL = {
4
+ const LOG_LEVEL_ENUM = {
5
5
  INFO: "info",
6
6
  WARN: "warn",
7
7
  ERROR: "error",
8
8
  FATAL: "fatal"
9
9
  };
10
- const LOG_LEVELS = [
11
- LOG_LEVEL.INFO,
12
- LOG_LEVEL.WARN,
13
- LOG_LEVEL.ERROR,
14
- LOG_LEVEL.FATAL
15
- ];
16
- const DEFAULT_MINIMUM_LOG_LEVEL = {
17
- DEVELOPMENT: LOG_LEVEL.INFO,
18
- PRODUCTION: LOG_LEVEL.WARN
10
+ const DEFAULT_MINIMUM_LOG_LEVEL_ENUM = {
11
+ DEVELOPMENT: LOG_LEVEL_ENUM.INFO,
12
+ PRODUCTION: LOG_LEVEL_ENUM.WARN
19
13
  };
20
- const DEFAULT_LOG_DIR_NAME = {
14
+ const DEFAULT_LOG_DIR_NAME_ENUM = {
21
15
  ROOT: "logs",
22
16
  MAIN: "main-thread",
23
17
  WORKER: "worker-threads"
@@ -76,7 +70,7 @@ const LogContextSchema = z.object({
76
70
  // src/schemas/log/id.ts
77
71
  const LogIdSchema = z.uuidv7().transform((id) => id);
78
72
  // src/schemas/log/level.ts
79
- const LogLevelSchema = z.enum(LOG_LEVELS);
73
+ const LogLevelSchema = z.enum(LOG_LEVEL_ENUM);
80
74
  // src/schemas/log/index.ts
81
75
  function createLogSchema({ name, inputSchema, outputSchema, operationsSchema }) {
82
76
  const SequentialOperationsSchema = createSequentialOperationsSchema({
@@ -98,4 +92,4 @@ var Logger = class {};
98
92
  function composeLogMessage({ level, who, didWhat, inWhere, atWhen }) {
99
93
  return `[${level.toUpperCase()}] ${who} ${didWhat}${inWhere ? " " + inWhere : ""} ${new Date(atWhen).toISOString()}.`;
100
94
  }
101
- export { DEFAULT_LOG_DIR_NAME, DEFAULT_MINIMUM_LOG_LEVEL, LOG_LEVEL, LOG_LEVELS, LogContextSchema, LogIdSchema, LogLevelSchema, Logger, OperationIdSchema, OperationPerformanceSchema, composeLogMessage, createConcurrentOperationsSchema, createLogSchema, createOperationSchema, createSequentialOperationsSchema };
95
+ export { DEFAULT_LOG_DIR_NAME_ENUM, DEFAULT_MINIMUM_LOG_LEVEL_ENUM, LOG_LEVEL_ENUM, LogContextSchema, LogIdSchema, LogLevelSchema, Logger, OperationIdSchema, OperationPerformanceSchema, composeLogMessage, createConcurrentOperationsSchema, createLogSchema, createOperationSchema, createSequentialOperationsSchema };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@little-nebulae/log",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "license": "MIT",
5
5
  "files": [
6
6
  "dist"
@@ -17,28 +17,33 @@
17
17
  },
18
18
  "devDependencies": {
19
19
  "@arethetypeswrong/core": "0.18.5",
20
- "@little-nebulae/zod-schemas": "0.2.0",
21
- "@oxc-node/cli": "1.0.1",
22
- "@types/node": "26.6.5",
23
- "oxfmt": "0.74.0",
24
- "oxlint": "1.89.0",
25
- "oxlint-tsgolint": "7.0.2005",
20
+ "@little-nebulae/zod-schemas": "0.3.0",
21
+ "@oxc-node/cli": "1.0.3",
22
+ "@types/node": "26.6.11",
23
+ "oxfmt": "0.80.0",
24
+ "oxlint": "1.95.0",
25
+ "oxlint-tsgolint": "7.0.2009",
26
26
  "publint": "0.3.25",
27
- "tsdown": "0.23.2",
28
- "type-fest": "5.10.0",
27
+ "tsdown": "0.23.7",
28
+ "type-fest": "6.0.3",
29
29
  "typescript": "7.1.0-beta",
30
- "vitest": "5.0.5",
30
+ "vitest": "5.1.2",
31
31
  "zod": "4.6.7"
32
32
  },
33
33
  "peerDependencies": {
34
34
  "@little-nebulae/zod-schemas": "0",
35
- "type-fest": "^5.0.0",
35
+ "type-fest": "^6.0.0",
36
36
  "zod": "^4.0.0"
37
37
  },
38
38
  "devEngines": {
39
39
  "packageManager": {
40
40
  "name": "pnpm",
41
- "version": "12.15.0",
41
+ "version": "12.23.0",
42
+ "onFail": "warn"
43
+ },
44
+ "runtime": {
45
+ "name": "node",
46
+ "version": "26.14.0",
42
47
  "onFail": "warn"
43
48
  }
44
49
  },