Skip to content

Commit a43ac8e

Browse files
committed
fix(logging): improve error logging format in LeetCode services
1 parent fe637bf commit a43ac8e

File tree

3 files changed

+4
-10
lines changed

3 files changed

+4
-10
lines changed

src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,6 @@ async function main() {
104104
}
105105

106106
main().catch((error) => {
107-
logger.error("Failed to start LeetCode MCP Server:", error);
107+
logger.error("Failed to start LeetCode MCP Server: %s", error);
108108
process.exit(1);
109109
});

src/leetcode/leetcode-cn-service.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -208,9 +208,7 @@ export class LeetCodeCNService implements LeetCodeBaseService {
208208
difficulty: q.difficulty
209209
}));
210210
} catch (e) {
211-
logger.error("Error parsing similarQuestions:", {
212-
error: e
213-
});
211+
logger.error("Error parsing similarQuestions: %s", e);
214212
}
215213
}
216214

@@ -359,7 +357,7 @@ export class LeetCodeCNService implements LeetCodeBaseService {
359357
* @returns Promise resolving to the solution detail data
360358
*/
361359
async fetchSolutionArticleDetail(slug: string): Promise<any> {
362-
const data = await this.leetCodeApi
360+
return await this.leetCodeApi
363361
.graphql({
364362
query: SOLUTION_ARTICLE_DETAIL_QUERY,
365363
variables: {
@@ -369,8 +367,6 @@ export class LeetCodeCNService implements LeetCodeBaseService {
369367
.then((res) => {
370368
return res.data?.solutionArticle;
371369
});
372-
logger.info(data);
373-
return data;
374370
}
375371

376372
/**

src/leetcode/leetcode-global-service.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -177,9 +177,7 @@ export class LeetCodeGlobalService implements LeetCodeBaseService {
177177
difficulty: q.difficulty
178178
}));
179179
} catch (e) {
180-
logger.error("Error parsing similarQuestions:", {
181-
error: e
182-
});
180+
logger.error("Error parsing similarQuestions: %s", e);
183181
}
184182
}
185183

0 commit comments

Comments
 (0)