hazo_ui 3.1.1 → 3.1.2
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/CHANGE_LOG.md +30 -18
- package/dist/index.cjs +7 -18
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +13 -12
- package/dist/index.d.ts +13 -12
- package/dist/index.js +4 -15
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -83,15 +83,16 @@ declare function HazoContextProvider({ correlationId, userId, children, }: HazoC
|
|
|
83
83
|
/**
|
|
84
84
|
* Logger utility for hazo_ui.
|
|
85
85
|
*
|
|
86
|
-
*
|
|
87
|
-
*
|
|
88
|
-
*
|
|
89
|
-
*
|
|
86
|
+
* hazo_ui ships as a "use client" bundle, so we cannot statically import
|
|
87
|
+
* hazo_core's `createLogger` here. hazo_core's browser entry deliberately
|
|
88
|
+
* omits `createLogger` (it loads hazo_logs dynamically, a Node-only
|
|
89
|
+
* package), and Turbopack flags namespace-member access against
|
|
90
|
+
* statically-known missing exports — even property reads — as a bundle
|
|
91
|
+
* error. So the default logger writes to console.
|
|
90
92
|
*
|
|
91
|
-
*
|
|
92
|
-
*
|
|
93
|
-
*
|
|
94
|
-
* of the workspace rather than reaching for `console`.
|
|
93
|
+
* Server-side consumers that want structured logs through hazo_core +
|
|
94
|
+
* hazo_logs should call `set_logger(createLogger("hazo_ui"))` from a server
|
|
95
|
+
* boot path. The override mechanism is unchanged.
|
|
95
96
|
*/
|
|
96
97
|
interface Logger {
|
|
97
98
|
info: (message: string, data?: Record<string, unknown>) => void;
|
|
@@ -100,13 +101,13 @@ interface Logger {
|
|
|
100
101
|
error: (message: string, data?: Record<string, unknown>) => void;
|
|
101
102
|
}
|
|
102
103
|
/**
|
|
103
|
-
* Set the logger instance used throughout hazo_ui.
|
|
104
|
-
*
|
|
104
|
+
* Set the logger instance used throughout hazo_ui. Pass `undefined` to
|
|
105
|
+
* reset to the console fallback.
|
|
105
106
|
*/
|
|
106
107
|
declare function set_logger(logger: Logger | undefined): void;
|
|
107
108
|
/**
|
|
108
|
-
* Get the current logger instance
|
|
109
|
-
*
|
|
109
|
+
* Get the current logger instance. Defaults to a console writer; override
|
|
110
|
+
* with `set_logger(...)` to plug in hazo_core's structured logger.
|
|
110
111
|
*/
|
|
111
112
|
declare function get_logger(): Logger;
|
|
112
113
|
|
package/dist/index.d.ts
CHANGED
|
@@ -83,15 +83,16 @@ declare function HazoContextProvider({ correlationId, userId, children, }: HazoC
|
|
|
83
83
|
/**
|
|
84
84
|
* Logger utility for hazo_ui.
|
|
85
85
|
*
|
|
86
|
-
*
|
|
87
|
-
*
|
|
88
|
-
*
|
|
89
|
-
*
|
|
86
|
+
* hazo_ui ships as a "use client" bundle, so we cannot statically import
|
|
87
|
+
* hazo_core's `createLogger` here. hazo_core's browser entry deliberately
|
|
88
|
+
* omits `createLogger` (it loads hazo_logs dynamically, a Node-only
|
|
89
|
+
* package), and Turbopack flags namespace-member access against
|
|
90
|
+
* statically-known missing exports — even property reads — as a bundle
|
|
91
|
+
* error. So the default logger writes to console.
|
|
90
92
|
*
|
|
91
|
-
*
|
|
92
|
-
*
|
|
93
|
-
*
|
|
94
|
-
* of the workspace rather than reaching for `console`.
|
|
93
|
+
* Server-side consumers that want structured logs through hazo_core +
|
|
94
|
+
* hazo_logs should call `set_logger(createLogger("hazo_ui"))` from a server
|
|
95
|
+
* boot path. The override mechanism is unchanged.
|
|
95
96
|
*/
|
|
96
97
|
interface Logger {
|
|
97
98
|
info: (message: string, data?: Record<string, unknown>) => void;
|
|
@@ -100,13 +101,13 @@ interface Logger {
|
|
|
100
101
|
error: (message: string, data?: Record<string, unknown>) => void;
|
|
101
102
|
}
|
|
102
103
|
/**
|
|
103
|
-
* Set the logger instance used throughout hazo_ui.
|
|
104
|
-
*
|
|
104
|
+
* Set the logger instance used throughout hazo_ui. Pass `undefined` to
|
|
105
|
+
* reset to the console fallback.
|
|
105
106
|
*/
|
|
106
107
|
declare function set_logger(logger: Logger | undefined): void;
|
|
107
108
|
/**
|
|
108
|
-
* Get the current logger instance
|
|
109
|
-
*
|
|
109
|
+
* Get the current logger instance. Defaults to a console writer; override
|
|
110
|
+
* with `set_logger(...)` to plug in hazo_core's structured logger.
|
|
110
111
|
*/
|
|
111
112
|
declare function get_logger(): Logger;
|
|
112
113
|
|
package/dist/index.js
CHANGED
|
@@ -3,7 +3,6 @@ import { clsx } from 'clsx';
|
|
|
3
3
|
import { twMerge } from 'tailwind-merge';
|
|
4
4
|
import * as React26 from 'react';
|
|
5
5
|
import React26__default, { useRef, useState, useCallback, useEffect, useMemo, Fragment } from 'react';
|
|
6
|
-
import * as hazoCore from 'hazo_core';
|
|
7
6
|
import { generateRequestId } from 'hazo_core';
|
|
8
7
|
import { withContext, setBrowserCorrelationId } from 'hazo_core/client';
|
|
9
8
|
import { jsx, jsxs, Fragment as Fragment$1 } from 'react/jsx-runtime';
|
|
@@ -152,29 +151,19 @@ function HazoContextProvider({
|
|
|
152
151
|
}, [id, userId]);
|
|
153
152
|
return /* @__PURE__ */ jsx(Fragment$1, { children });
|
|
154
153
|
}
|
|
154
|
+
|
|
155
|
+
// src/utils/logger.ts
|
|
155
156
|
var console_logger = {
|
|
156
157
|
info: (m, d) => d ? console.log(`[hazo_ui] ${m}`, d) : console.log(`[hazo_ui] ${m}`),
|
|
157
158
|
debug: (m, d) => d ? console.debug(`[hazo_ui] ${m}`, d) : console.debug(`[hazo_ui] ${m}`),
|
|
158
159
|
warn: (m, d) => d ? console.warn(`[hazo_ui] ${m}`, d) : console.warn(`[hazo_ui] ${m}`),
|
|
159
160
|
error: (m, d) => d ? console.error(`[hazo_ui] ${m}`, d) : console.error(`[hazo_ui] ${m}`)
|
|
160
161
|
};
|
|
161
|
-
|
|
162
|
-
const factory = hazoCore.createLogger;
|
|
163
|
-
if (typeof factory !== "function") return console_logger;
|
|
164
|
-
try {
|
|
165
|
-
return factory("hazo_ui");
|
|
166
|
-
} catch {
|
|
167
|
-
return console_logger;
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
var current_logger = null;
|
|
162
|
+
var current_logger = console_logger;
|
|
171
163
|
function set_logger(logger) {
|
|
172
|
-
current_logger = logger ??
|
|
164
|
+
current_logger = logger ?? console_logger;
|
|
173
165
|
}
|
|
174
166
|
function get_logger() {
|
|
175
|
-
if (!current_logger) {
|
|
176
|
-
current_logger = build_default_logger();
|
|
177
|
-
}
|
|
178
167
|
return current_logger;
|
|
179
168
|
}
|
|
180
169
|
function generateUUID() {
|