Spaces:
Running
Running
Fix error logging (#1228)
Browse filesLogging was switched to Pino. For error logging, Pino wants the object first, and
then the string message. For example see this thread: https://github.com/pinojs/pino/issues/673
- src/lib/migrations/routines/03-add-tools-in-settings.ts +1 -1
- src/lib/server/database.ts +1 -1
- src/lib/server/embeddingEndpoints/hfApi/embeddingHfApi.ts +1 -1
- src/lib/server/endpoints/cloudflare/endpointCloudflare.ts +1 -1
- src/lib/server/endpoints/langserve/endpointLangserve.ts +1 -1
- src/lib/server/endpoints/llamacpp/endpointLlamacpp.ts +1 -1
- src/lib/server/websearch/search/endpoints/searxng.ts +1 -1
src/lib/migrations/routines/03-add-tools-in-settings.ts
CHANGED
@@ -19,7 +19,7 @@ const addToolsToSettings: Migration = {
|
|
19 |
|
20 |
settings
|
21 |
.createIndex({ tools: 1 })
|
22 |
-
.catch((e) => logger.error("Error creating index during tools migration"
|
23 |
|
24 |
return true;
|
25 |
},
|
|
|
19 |
|
20 |
settings
|
21 |
.createIndex({ tools: 1 })
|
22 |
+
.catch((e) => logger.error(e, "Error creating index during tools migration"));
|
23 |
|
24 |
return true;
|
25 |
},
|
src/lib/server/database.ts
CHANGED
@@ -35,7 +35,7 @@ export class Database {
|
|
35 |
});
|
36 |
|
37 |
this.client.connect().catch((err) => {
|
38 |
-
logger.error("Connection error"
|
39 |
process.exit(1);
|
40 |
});
|
41 |
this.client.db(env.MONGODB_DB_NAME + (import.meta.env.MODE === "test" ? "-test" : ""));
|
|
|
35 |
});
|
36 |
|
37 |
this.client.connect().catch((err) => {
|
38 |
+
logger.error(err, "Connection error");
|
39 |
process.exit(1);
|
40 |
});
|
41 |
this.client.db(env.MONGODB_DB_NAME + (import.meta.env.MODE === "test" ? "-test" : ""));
|
src/lib/server/embeddingEndpoints/hfApi/embeddingHfApi.ts
CHANGED
@@ -42,7 +42,7 @@ export async function embeddingEndpointHfApi(
|
|
42 |
|
43 |
if (!response.ok) {
|
44 |
logger.error(await response.text());
|
45 |
-
logger.error("Failed to get embeddings from Hugging Face API"
|
46 |
return [];
|
47 |
}
|
48 |
|
|
|
42 |
|
43 |
if (!response.ok) {
|
44 |
logger.error(await response.text());
|
45 |
+
logger.error(response, "Failed to get embeddings from Hugging Face API");
|
46 |
return [];
|
47 |
}
|
48 |
|
src/lib/server/endpoints/cloudflare/endpointCloudflare.ts
CHANGED
@@ -105,7 +105,7 @@ export async function endpointCloudflare(
|
|
105 |
try {
|
106 |
data = JSON.parse(jsonString);
|
107 |
} catch (e) {
|
108 |
-
logger.error("Failed to parse JSON"
|
109 |
logger.error("Problematic JSON string:", jsonString);
|
110 |
continue; // Skip this iteration and try the next chunk
|
111 |
}
|
|
|
105 |
try {
|
106 |
data = JSON.parse(jsonString);
|
107 |
} catch (e) {
|
108 |
+
logger.error(e, "Failed to parse JSON");
|
109 |
logger.error("Problematic JSON string:", jsonString);
|
110 |
continue; // Skip this iteration and try the next chunk
|
111 |
}
|
src/lib/server/endpoints/langserve/endpointLangserve.ts
CHANGED
@@ -100,7 +100,7 @@ export function endpointLangserve(
|
|
100 |
try {
|
101 |
data = JSON.parse(jsonString);
|
102 |
} catch (e) {
|
103 |
-
logger.error("Failed to parse JSON"
|
104 |
logger.error("Problematic JSON string:", jsonString);
|
105 |
continue; // Skip this iteration and try the next chunk
|
106 |
}
|
|
|
100 |
try {
|
101 |
data = JSON.parse(jsonString);
|
102 |
} catch (e) {
|
103 |
+
logger.error(e, "Failed to parse JSON");
|
104 |
logger.error("Problematic JSON string:", jsonString);
|
105 |
continue; // Skip this iteration and try the next chunk
|
106 |
}
|
src/lib/server/endpoints/llamacpp/endpointLlamacpp.ts
CHANGED
@@ -94,7 +94,7 @@ export function endpointLlamacpp(
|
|
94 |
try {
|
95 |
data = JSON.parse(jsonString);
|
96 |
} catch (e) {
|
97 |
-
logger.error("Failed to parse JSON"
|
98 |
logger.error("Problematic JSON string:", jsonString);
|
99 |
continue; // Skip this iteration and try the next chunk
|
100 |
}
|
|
|
94 |
try {
|
95 |
data = JSON.parse(jsonString);
|
96 |
} catch (e) {
|
97 |
+
logger.error(e, "Failed to parse JSON");
|
98 |
logger.error("Problematic JSON string:", jsonString);
|
99 |
continue; // Skip this iteration and try the next chunk
|
100 |
}
|
src/lib/server/websearch/search/endpoints/searxng.ts
CHANGED
@@ -21,7 +21,7 @@ export default async function searchSearxng(query: string): Promise<WebSearchSou
|
|
21 |
})
|
22 |
.then((response) => response.json() as Promise<{ results: { url: string }[] }>)
|
23 |
.catch((error) => {
|
24 |
-
logger.error("Failed to fetch or parse JSON"
|
25 |
throw new Error("Failed to fetch or parse JSON", { cause: error });
|
26 |
});
|
27 |
|
|
|
21 |
})
|
22 |
.then((response) => response.json() as Promise<{ results: { url: string }[] }>)
|
23 |
.catch((error) => {
|
24 |
+
logger.error(error, "Failed to fetch or parse JSON");
|
25 |
throw new Error("Failed to fetch or parse JSON", { cause: error });
|
26 |
});
|
27 |
|