Skip to content

Commit a7e5d75

Browse files
switch apis from debug to log
1 parent 35e504e commit a7e5d75

File tree

4 files changed

+24
-24
lines changed

4 files changed

+24
-24
lines changed

app/api/cron/route.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export function GET(request: NextRequest) {
99
});
1010
}
1111
// Don't await just trigger
12-
console.debug('youtube views triggered');
12+
console.log('youtube views triggered');
1313
fetch(publicURL() + `/api/youtube/views`,
1414
{ headers: { authorization: `Bearer ${process.env.CRON_SECRET}` } });
1515

app/api/devto/route.tsx

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ const formatPodcast = async (_type: string, slug: string) => {
6767
return Response.json({ success: false, error: "Podcast not found" }, { status: 404 });
6868
}
6969

70-
console.debug('Adding', { slug: podcast?.slug, devto: podcast?.devto });
70+
console.log('Adding', { slug: podcast?.slug, devto: podcast?.devto });
7171

7272
try {
7373
const article: any = {
@@ -92,28 +92,28 @@ ${toMarkdown(podcast.content, { serializers })}`
9292
article.article.tags.push('podcast');
9393
article.article.series = `codingcatdev_podcast_${podcast?.season || 4}`;
9494
}
95-
console.debug("article", JSON.stringify(article, null, 2));
95+
console.log("article", JSON.stringify(article, null, 2));
9696

9797
let response;
9898
if (podcast?.devto) {
99-
console.debug('updateArticle to devto');
99+
console.log('updateArticle to devto');
100100
response = await updateArticle(podcast.devto, article);
101-
console.debug('updateArticle result:', response.status);
101+
console.log('updateArticle result:', response.status);
102102
} else {
103-
console.debug('addArticle to devto');
103+
console.log('addArticle to devto');
104104
response = await addArticle(article);
105-
console.debug('addArticle result:', response.status);
105+
console.log('addArticle result:', response.status);
106106
}
107107

108108
const json = await response.json();
109-
console.debug("result payload", JSON.stringify(json, null, 2));
109+
console.log("result payload", JSON.stringify(json, null, 2));
110110

111111
// Get new devto url and update
112112
if (response.status >= 200 && response.status <= 299) {
113113
if (json?.url && !podcast?.devto) {
114-
console.debug('Article Added to Dev.to', JSON.stringify(json, null, 2));
114+
console.log('Article Added to Dev.to', JSON.stringify(json, null, 2));
115115
await updateSanity(podcast._id, json.url);
116-
console.debug('Sanity Updated', podcast._id, json.url);
116+
console.log('Sanity Updated', podcast._id, json.url);
117117
}
118118
}
119119
return Response.json({ success: true }, { status: 201 });
@@ -131,7 +131,7 @@ const unPublishPodcast = async (_type: string, id: string, devto: string) => {
131131
return Response.json({ success: false, error: "Podcast not found" }, { status: 404 });
132132
}
133133

134-
console.debug('Unpublishing', { _type, id, devto });
134+
console.log('Unpublishing', { _type, id, devto });
135135

136136
try {
137137

@@ -142,7 +142,7 @@ const unPublishPodcast = async (_type: string, id: string, devto: string) => {
142142

143143
// Remove devto from sanity
144144
if (response.status >= 200 && response.status <= 299) {
145-
console.debug('removed post from devto')
145+
console.log('removed post from devto')
146146
return Response.json({ success: true }, { status: 200 });
147147
}
148148
return Response.json({ success: true }, { status: 200 });

app/api/hashnode/route.tsx

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ const formatPodcast = async (_type: string, slug: string) => {
7171
return Response.json({ success: false, error: "Podcast not found" }, { status: 404 });
7272
}
7373

74-
console.debug('Adding', { slug: podcast?.slug, hashnode: podcast?.hashnode });
74+
console.log('Adding', { slug: podcast?.slug, hashnode: podcast?.hashnode });
7575

7676
try {
7777
const article: any = {
@@ -116,29 +116,29 @@ ${toMarkdown(podcast.content, { serializers })}`
116116
});
117117
article.seriesId = '65a9ad4ef60adbf4aeedd0a2';
118118
}
119-
console.debug("article", JSON.stringify(article, null, 2));
119+
console.log("article", JSON.stringify(article, null, 2));
120120

121121
let response;
122122
if (podcast?.hashnode) {
123-
console.debug('updateArticle to hashnode');
123+
console.log('updateArticle to hashnode');
124124
response = await updateArticle(podcast.hashnode, article);
125-
console.debug('updateArticle result:', response.status);
125+
console.log('updateArticle result:', response.status);
126126
} else {
127-
console.debug('addArticle to hashnode');
127+
console.log('addArticle to hashnode');
128128
response = await addArticle(article);
129-
console.debug('addArticle result:', response.status);
129+
console.log('addArticle result:', response.status);
130130
}
131131

132132
const json = await response.json();
133-
console.debug("result payload", JSON.stringify(json, null, 2));
133+
console.log("result payload", JSON.stringify(json, null, 2));
134134

135135
// Get new hashnode url and update
136136
if (response.status >= 200 && response.status <= 299) {
137137
const hashnode = json?.data?.publishPost?.post?.slug;
138138
if (hashnode && !podcast?.hashnode) {
139-
console.debug('Article Added to hashnode', JSON.stringify(json, null, 2));
139+
console.log('Article Added to hashnode', JSON.stringify(json, null, 2));
140140
await updateSanity(podcast._id, hashnode);
141-
console.debug('Sanity Updated', podcast._id, hashnode);
141+
console.log('Sanity Updated', podcast._id, hashnode);
142142
}
143143
}
144144
return Response.json({ success: true }, { status: 201 });
@@ -156,7 +156,7 @@ const unPublishPodcast = async (_type: string, id: string, hashnode: string) =>
156156
return Response.json({ success: false, error: "Podcast not found" }, { status: 404 });
157157
}
158158

159-
console.debug('Unpublishing', { _type, id, hashnode });
159+
console.log('Unpublishing', { _type, id, hashnode });
160160

161161
try {
162162

app/api/youtube/views/route.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export async function GET(request: NextRequest) {
3535

3636
if (!lastId) {
3737
const message = `No doc found based on lastId ${lastId}`;
38-
console.debug(message);
38+
console.log(message);
3939
return Response.json({ success: true, message }, { status: 200 });
4040
}
4141

@@ -58,7 +58,7 @@ export async function GET(request: NextRequest) {
5858
console.error(JSON.stringify(json));
5959
return Response.json(json, { status: videoResp.status })
6060
}
61-
console.debug(JSON.stringify(json));
61+
console.log(JSON.stringify(json));
6262
const statistics = json?.items?.at(0)?.statistics;
6363

6464
if (!statistics) {

0 commit comments

Comments
 (0)