@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.js
CHANGED
|
@@ -15826,7 +15826,7 @@ var DEFAULT_REALTIME_CONFIG = {
|
|
|
15826
15826
|
burst: 60
|
|
15827
15827
|
},
|
|
15828
15828
|
logging: {
|
|
15829
|
-
level: "info",
|
|
15829
|
+
level: process.env.NODE_ENV === "production" ? "warn" : "info",
|
|
15830
15830
|
pretty: process.env.NODE_ENV !== "production"
|
|
15831
15831
|
}
|
|
15832
15832
|
};
|
|
@@ -16663,13 +16663,24 @@ function validateSchema(schema, data) {
|
|
|
16663
16663
|
}
|
|
16664
16664
|
|
|
16665
16665
|
// modules/realtime/logging/index.ts
|
|
16666
|
-
|
|
16666
|
+
var LOG_LEVELS = {
|
|
16667
|
+
debug: 0,
|
|
16668
|
+
info: 1,
|
|
16669
|
+
warn: 2,
|
|
16670
|
+
error: 3
|
|
16671
|
+
};
|
|
16672
|
+
function createWssLogger(namespace, socket, baseLogger, minLevel = "info") {
|
|
16667
16673
|
const context = {
|
|
16668
16674
|
namespace,
|
|
16669
16675
|
socketId: socket.id,
|
|
16670
16676
|
userId: socket.data?.user?.id || null
|
|
16671
16677
|
};
|
|
16678
|
+
const minLevelNum = LOG_LEVELS[minLevel] ?? LOG_LEVELS.info;
|
|
16672
16679
|
const log = (level, message, meta) => {
|
|
16680
|
+
const levelNum = LOG_LEVELS[level] ?? LOG_LEVELS.info;
|
|
16681
|
+
if (levelNum < minLevelNum) {
|
|
16682
|
+
return;
|
|
16683
|
+
}
|
|
16673
16684
|
const fullMeta = {
|
|
16674
16685
|
...context,
|
|
16675
16686
|
...meta,
|
|
@@ -16856,7 +16867,8 @@ async function setupWssEvents(options) {
|
|
|
16856
16867
|
namespace.on("connection", async (socket) => {
|
|
16857
16868
|
const requestId = generateRequestId();
|
|
16858
16869
|
socket.requestId = requestId;
|
|
16859
|
-
const
|
|
16870
|
+
const logLevel = realtimeConfig.logging?.level || (process.env.NODE_ENV === "production" ? "warn" : "info");
|
|
16871
|
+
const log = createWssLogger(namespacePath, socket, void 0, logLevel);
|
|
16860
16872
|
try {
|
|
16861
16873
|
const user = await executeAuth(normalized.auth, socket, namespacePath);
|
|
16862
16874
|
socket.data = socket.data || {};
|
|
@@ -16891,7 +16903,8 @@ async function setupWssEvents(options) {
|
|
|
16891
16903
|
socket.on(eventName, async (data) => {
|
|
16892
16904
|
const eventRequestId = generateRequestId();
|
|
16893
16905
|
socket.requestId = eventRequestId;
|
|
16894
|
-
const
|
|
16906
|
+
const eventLogLevel = realtimeConfig.logging?.level || (process.env.NODE_ENV === "production" ? "warn" : "info");
|
|
16907
|
+
const eventLog = createWssLogger(namespacePath, socket, void 0, eventLogLevel);
|
|
16895
16908
|
eventLog.debug(`Event received: ${eventName}`, { data });
|
|
16896
16909
|
try {
|
|
16897
16910
|
const ctx = {
|
|
@@ -16949,7 +16962,8 @@ async function setupWssEvents(options) {
|
|
|
16949
16962
|
await eventDef.handler(ctx);
|
|
16950
16963
|
eventLog.debug(`Event handled: ${eventName}`);
|
|
16951
16964
|
} catch (error) {
|
|
16952
|
-
const
|
|
16965
|
+
const errorLogLevel = realtimeConfig.logging?.level || (process.env.NODE_ENV === "production" ? "warn" : "info");
|
|
16966
|
+
const errorLog = createWssLogger(namespacePath, socket, void 0, errorLogLevel);
|
|
16953
16967
|
errorLog.error(`Error handling event ${eventName}`, {
|
|
16954
16968
|
error: error instanceof Error ? error.message : String(error),
|
|
16955
16969
|
stack: error instanceof Error ? error.stack : void 0
|
|
@@ -16969,9 +16983,10 @@ async function setupWssEvents(options) {
|
|
|
16969
16983
|
}
|
|
16970
16984
|
if (normalized.onDisconnect) {
|
|
16971
16985
|
try {
|
|
16986
|
+
const disconnectLogLevel = realtimeConfig.logging?.level || (process.env.NODE_ENV === "production" ? "warn" : "info");
|
|
16972
16987
|
const disconnectCtx = {
|
|
16973
16988
|
...baseCtx,
|
|
16974
|
-
log: createWssLogger(namespacePath, socket)
|
|
16989
|
+
log: createWssLogger(namespacePath, socket, void 0, disconnectLogLevel)
|
|
16975
16990
|
};
|
|
16976
16991
|
await normalized.onDisconnect(disconnectCtx, reason);
|
|
16977
16992
|
} catch (error) {
|
|
@@ -18710,9 +18725,7 @@ function AppShell({
|
|
|
18710
18725
|
function setupHotReload2() {
|
|
18711
18726
|
const nodeEnv = process.env.NODE_ENV || "production";
|
|
18712
18727
|
const isDev = nodeEnv === "development";
|
|
18713
|
-
console.log(`[hot-reload] NODE_ENV: ${nodeEnv}, isDev: ${isDev}`);
|
|
18714
18728
|
if (!isDev) {
|
|
18715
|
-
console.log("[hot-reload] Skipping hot reload setup (not in development mode)");
|
|
18716
18729
|
return;
|
|
18717
18730
|
}
|
|
18718
18731
|
console.log("[hot-reload] Setting up hot reload client...");
|