@lolyjs/core 0.2.0-alpha.25 → 0.2.0-alpha.27
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/cli.cjs +21 -6
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +21 -6
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +21 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +21 -8
- package/dist/index.js.map +1 -1
- package/dist/runtime.cjs +0 -2
- package/dist/runtime.cjs.map +1 -1
- package/dist/runtime.js +0 -2
- package/dist/runtime.js.map +1 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -15859,7 +15859,7 @@ var DEFAULT_REALTIME_CONFIG = {
|
|
|
15859
15859
|
burst: 60
|
|
15860
15860
|
},
|
|
15861
15861
|
logging: {
|
|
15862
|
-
level: "info",
|
|
15862
|
+
level: process.env.NODE_ENV === "production" ? "warn" : "info",
|
|
15863
15863
|
pretty: process.env.NODE_ENV !== "production"
|
|
15864
15864
|
}
|
|
15865
15865
|
};
|
|
@@ -16696,13 +16696,24 @@ function validateSchema(schema, data) {
|
|
|
16696
16696
|
}
|
|
16697
16697
|
|
|
16698
16698
|
// modules/realtime/logging/index.ts
|
|
16699
|
-
|
|
16699
|
+
var LOG_LEVELS = {
|
|
16700
|
+
debug: 0,
|
|
16701
|
+
info: 1,
|
|
16702
|
+
warn: 2,
|
|
16703
|
+
error: 3
|
|
16704
|
+
};
|
|
16705
|
+
function createWssLogger(namespace, socket, baseLogger, minLevel = "info") {
|
|
16700
16706
|
const context = {
|
|
16701
16707
|
namespace,
|
|
16702
16708
|
socketId: socket.id,
|
|
16703
16709
|
userId: socket.data?.user?.id || null
|
|
16704
16710
|
};
|
|
16711
|
+
const minLevelNum = LOG_LEVELS[minLevel] ?? LOG_LEVELS.info;
|
|
16705
16712
|
const log = (level, message, meta) => {
|
|
16713
|
+
const levelNum = LOG_LEVELS[level] ?? LOG_LEVELS.info;
|
|
16714
|
+
if (levelNum < minLevelNum) {
|
|
16715
|
+
return;
|
|
16716
|
+
}
|
|
16706
16717
|
const fullMeta = {
|
|
16707
16718
|
...context,
|
|
16708
16719
|
...meta,
|
|
@@ -16889,7 +16900,8 @@ async function setupWssEvents(options) {
|
|
|
16889
16900
|
namespace.on("connection", async (socket) => {
|
|
16890
16901
|
const requestId = generateRequestId();
|
|
16891
16902
|
socket.requestId = requestId;
|
|
16892
|
-
const
|
|
16903
|
+
const logLevel = realtimeConfig.logging?.level || (process.env.NODE_ENV === "production" ? "warn" : "info");
|
|
16904
|
+
const log = createWssLogger(namespacePath, socket, void 0, logLevel);
|
|
16893
16905
|
try {
|
|
16894
16906
|
const user = await executeAuth(normalized.auth, socket, namespacePath);
|
|
16895
16907
|
socket.data = socket.data || {};
|
|
@@ -16924,7 +16936,8 @@ async function setupWssEvents(options) {
|
|
|
16924
16936
|
socket.on(eventName, async (data) => {
|
|
16925
16937
|
const eventRequestId = generateRequestId();
|
|
16926
16938
|
socket.requestId = eventRequestId;
|
|
16927
|
-
const
|
|
16939
|
+
const eventLogLevel = realtimeConfig.logging?.level || (process.env.NODE_ENV === "production" ? "warn" : "info");
|
|
16940
|
+
const eventLog = createWssLogger(namespacePath, socket, void 0, eventLogLevel);
|
|
16928
16941
|
eventLog.debug(`Event received: ${eventName}`, { data });
|
|
16929
16942
|
try {
|
|
16930
16943
|
const ctx = {
|
|
@@ -16982,7 +16995,8 @@ async function setupWssEvents(options) {
|
|
|
16982
16995
|
await eventDef.handler(ctx);
|
|
16983
16996
|
eventLog.debug(`Event handled: ${eventName}`);
|
|
16984
16997
|
} catch (error) {
|
|
16985
|
-
const
|
|
16998
|
+
const errorLogLevel = realtimeConfig.logging?.level || (process.env.NODE_ENV === "production" ? "warn" : "info");
|
|
16999
|
+
const errorLog = createWssLogger(namespacePath, socket, void 0, errorLogLevel);
|
|
16986
17000
|
errorLog.error(`Error handling event ${eventName}`, {
|
|
16987
17001
|
error: error instanceof Error ? error.message : String(error),
|
|
16988
17002
|
stack: error instanceof Error ? error.stack : void 0
|
|
@@ -17002,9 +17016,10 @@ async function setupWssEvents(options) {
|
|
|
17002
17016
|
}
|
|
17003
17017
|
if (normalized.onDisconnect) {
|
|
17004
17018
|
try {
|
|
17019
|
+
const disconnectLogLevel = realtimeConfig.logging?.level || (process.env.NODE_ENV === "production" ? "warn" : "info");
|
|
17005
17020
|
const disconnectCtx = {
|
|
17006
17021
|
...baseCtx,
|
|
17007
|
-
log: createWssLogger(namespacePath, socket)
|
|
17022
|
+
log: createWssLogger(namespacePath, socket, void 0, disconnectLogLevel)
|
|
17008
17023
|
};
|
|
17009
17024
|
await normalized.onDisconnect(disconnectCtx, reason);
|
|
17010
17025
|
} catch (error) {
|
|
@@ -18743,9 +18758,7 @@ function AppShell({
|
|
|
18743
18758
|
function setupHotReload2() {
|
|
18744
18759
|
const nodeEnv = process.env.NODE_ENV || "production";
|
|
18745
18760
|
const isDev = nodeEnv === "development";
|
|
18746
|
-
console.log(`[hot-reload] NODE_ENV: ${nodeEnv}, isDev: ${isDev}`);
|
|
18747
18761
|
if (!isDev) {
|
|
18748
|
-
console.log("[hot-reload] Skipping hot reload setup (not in development mode)");
|
|
18749
18762
|
return;
|
|
18750
18763
|
}
|
|
18751
18764
|
console.log("[hot-reload] Setting up hot reload client...");
|