debug off
fix: logging
This commit is contained in:
@@ -462,7 +462,13 @@ export const saveBuildLog = async ({
|
|||||||
applicationId: string;
|
applicationId: string;
|
||||||
}): Promise<any> => {
|
}): Promise<any> => {
|
||||||
const { default: got } = await import('got')
|
const { default: got } = await import('got')
|
||||||
|
if (typeof line === 'object' && line) {
|
||||||
|
if (line.shortMessage) {
|
||||||
|
line = line.shortMessage;
|
||||||
|
} else {
|
||||||
|
line = JSON.stringify(line);
|
||||||
|
}
|
||||||
|
}
|
||||||
if (line && typeof line === 'string' && line.includes('ghs_')) {
|
if (line && typeof line === 'string' && line.includes('ghs_')) {
|
||||||
const regex = /ghs_.*@/g;
|
const regex = /ghs_.*@/g;
|
||||||
line = line.replace(regex, '<SENSITIVE_DATA_DELETED>@');
|
line = line.replace(regex, '<SENSITIVE_DATA_DELETED>@');
|
||||||
@@ -470,9 +476,9 @@ export const saveBuildLog = async ({
|
|||||||
const addTimestamp = `[${generateTimestamp()}] ${line}`;
|
const addTimestamp = `[${generateTimestamp()}] ${line}`;
|
||||||
const fluentBitUrl = isDev ? process.env.COOLIFY_CONTAINER_DEV === 'true' ? 'http://coolify-fluentbit:24224' : 'http://localhost:24224' : 'http://coolify-fluentbit:24224';
|
const fluentBitUrl = isDev ? process.env.COOLIFY_CONTAINER_DEV === 'true' ? 'http://coolify-fluentbit:24224' : 'http://localhost:24224' : 'http://coolify-fluentbit:24224';
|
||||||
|
|
||||||
// if (isDev && !process.env.COOLIFY_CONTAINER_DEV) {
|
if (isDev && !process.env.COOLIFY_CONTAINER_DEV) {
|
||||||
console.debug(`[${applicationId}] ${addTimestamp}`);
|
console.debug(`[${applicationId}] ${addTimestamp}`);
|
||||||
// }
|
}
|
||||||
try {
|
try {
|
||||||
return await got.post(`${fluentBitUrl}/${applicationId}_buildlog_${buildId}.csv`, {
|
return await got.post(`${fluentBitUrl}/${applicationId}_buildlog_${buildId}.csv`, {
|
||||||
json: {
|
json: {
|
||||||
@@ -480,7 +486,6 @@ export const saveBuildLog = async ({
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error)
|
|
||||||
return await prisma.buildLog.create({
|
return await prisma.buildLog.create({
|
||||||
data: {
|
data: {
|
||||||
line: addTimestamp, buildId, time: Number(day().valueOf()), applicationId
|
line: addTimestamp, buildId, time: Number(day().valueOf()), applicationId
|
||||||
|
Reference in New Issue
Block a user