Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit4d98b15

Browse files
committed
fix: fetch url logs
1 parent3c883b7 commit4d98b15

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed

‎Dockerfile‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ RUN touch /app/.env.local
2121

2222
USER root
2323
RUN apt-get update
24-
RUN apt-get install -y libgomp1 libcurl4
24+
RUN apt-get install -y libgomp1 libcurl4 curl dnsutils
2525

2626
# ensure npm cache dir exists before adjusting ownership
2727
RUN mkdir -p /home/user/.npm && chown -R 1000:1000 /home/user/.npm

‎src/lib/server/logger.ts‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,12 @@ if (dev) {
1515
};
1616
}
1717

18-
exportconstlogger=pino({ ...options,level:config.LOG_LEVEL||"info"});
18+
exportconstlogger=pino({
19+
...options,
20+
level:config.LOG_LEVEL||"info",
21+
formatters:{
22+
level:(label)=>{
23+
return{level:label};
24+
},
25+
},
26+
});

‎src/routes/api/fetch-url/+server.ts‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import{error}from"@sveltejs/kit";
2+
import{logger}from"$lib/server/logger.js";
23

34
constMAX_FILE_SIZE=10*1024*1024;// 10MB
45
constFETCH_TIMEOUT=30000;// 30 seconds
@@ -87,11 +88,14 @@ export async function GET({ url, fetch }) {
8788
}catch(err){
8889
if(errinstanceofError){
8990
if(err.name==="AbortError"){
91+
logger.error(err,`Request timeout`);
9092
throwerror(504,"Request timeout");
9193
}
92-
console.error("Error fetching URL:",err);
94+
95+
logger.error(err,`Error fetching URL`);
9396
throwerror(500,`Failed to fetch URL:${err.message}`);
9497
}
98+
logger.error(err,`Error fetching URL`);
9599
throwerror(500,"Failed to fetch URL");
96100
}
97101
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp