refactor(core): Convert verbose to debug logs (#10574)

This commit is contained in:
Iván Ovejero
2024-08-28 09:32:53 +02:00
committed by GitHub
parent ab9835126e
commit bc958be93b
54 changed files with 68 additions and 74 deletions

View File

@@ -95,7 +95,7 @@ export class ActiveWorkflowManager {
*/
async removeAll() {
let activeWorkflowIds: string[] = [];
this.logger.verbose('Call to remove all active workflows received (removeAll)');
this.logger.debug('Call to remove all active workflows received (removeAll)');
activeWorkflowIds.push(...this.activeWorkflows.allActiveWorkflows());
@@ -437,7 +437,7 @@ export class ActiveWorkflowManager {
});
if (wasActivated) {
this.logger.verbose(`Successfully started workflow ${dbWorkflow.display()}`, {
this.logger.debug(`Successfully started workflow ${dbWorkflow.display()}`, {
workflowName: dbWorkflow.name,
workflowId: dbWorkflow.id,
});
@@ -469,7 +469,7 @@ export class ActiveWorkflowManager {
}
}
this.logger.verbose('Finished activating workflows (startup)');
this.logger.debug('Finished activating workflows (startup)');
}
async clearAllActivationErrors() {
@@ -800,7 +800,7 @@ export class ActiveWorkflowManager {
getPollFunctions,
);
this.logger.verbose(`Workflow ${dbWorkflow.display()} activated`, {
this.logger.debug(`Workflow ${dbWorkflow.display()} activated`, {
workflowId: dbWorkflow.id,
workflowName: dbWorkflow.name,
});

View File

@@ -90,7 +90,7 @@ export class OAuth1CredentialController extends AbstractOAuthController {
decryptedDataOriginal.csrfSecret = csrfSecret;
await this.encryptAndSaveData(credential, decryptedDataOriginal);
this.logger.verbose('OAuth1 authorization successful for new credential', {
this.logger.debug('OAuth1 authorization successful for new credential', {
userId: req.user.id,
credentialId: credential.id,
});
@@ -170,7 +170,7 @@ export class OAuth1CredentialController extends AbstractOAuthController {
await this.encryptAndSaveData(credential, decryptedDataOriginal);
this.logger.verbose('OAuth1 callback successful for new credential', {
this.logger.debug('OAuth1 callback successful for new credential', {
credentialId,
});
return res.render('oauth-callback');

View File

@@ -71,7 +71,7 @@ export class OAuth2CredentialController extends AbstractOAuthController {
const oAuthObj = new ClientOAuth2(oAuthOptions);
const returnUri = oAuthObj.code.getUri();
this.logger.verbose('OAuth2 authorization url created for credential', {
this.logger.debug('OAuth2 authorization url created for credential', {
userId: req.user.id,
credentialId: credential.id,
});
@@ -172,7 +172,7 @@ export class OAuth2CredentialController extends AbstractOAuthController {
delete decryptedDataOriginal.csrfSecret;
await this.encryptAndSaveData(credential, decryptedDataOriginal);
this.logger.verbose('OAuth2 callback successful for credential', {
this.logger.debug('OAuth2 callback successful for credential', {
credentialId,
});

View File

@@ -40,7 +40,7 @@ export class WorkflowStatisticsController {
if (workflow) {
next();
} else {
this.logger.verbose('User attempted to read a workflow without permissions', {
this.logger.warn('User attempted to read a workflow without permissions', {
workflowId,
userId: user.id,
});

View File

@@ -218,7 +218,7 @@ export class CredentialsController {
// Remove the encrypted data as it is not needed in the frontend
const { data: _, ...rest } = responseData;
this.logger.verbose('Credential updated', { credentialId });
this.logger.debug('Credential updated', { credentialId });
this.eventService.emit('credentials-updated', {
user: req.user,

View File

@@ -388,7 +388,7 @@ export class CredentialsService {
return savedCredential;
});
this.logger.verbose('New credential created', {
this.logger.debug('New credential created', {
credentialId: newCredential.id,
ownerId: user.id,
});

View File

@@ -36,7 +36,7 @@ export class Logger {
if (output.includes('console')) {
let format: winston.Logform.Format;
if (['debug', 'verbose'].includes(level)) {
if (level === 'debug') {
format = winston.format.combine(
winston.format.metadata(),
winston.format.timestamp(),
@@ -115,8 +115,4 @@ export class Logger {
debug(message: string, meta: object = {}): void {
this.log('debug', message, meta);
}
verbose(message: string, meta: object = {}): void {
this.log('verbose', message, meta);
}
}

View File

@@ -41,7 +41,7 @@ export class ActiveWorkflowsService {
'workflow:read',
]);
if (!workflow) {
this.logger.verbose('User attempted to access workflow errors without permissions', {
this.logger.warn('User attempted to access workflow errors without permissions', {
workflowId,
userId: user.id,
});

View File

@@ -90,7 +90,7 @@ export class WorkflowStatisticsService extends TypedEmitter<WorkflowStatisticsEv
}
}
} catch (error) {
this.logger.verbose('Unable to fire first workflow success telemetry event');
this.logger.debug('Unable to fire first workflow success telemetry event');
}
}

View File

@@ -52,7 +52,7 @@ export class NodeMailer {
text: mailData.textOnly,
html: mailData.body,
});
this.logger.verbose(
this.logger.debug(
`Email sent successfully to the following recipients: ${mailData.emailRecipients.toString()}`,
);
} catch (error) {

View File

@@ -504,7 +504,7 @@ export async function executeWebhook(
responsePromise,
);
Container.get(Logger).verbose(
Container.get(Logger).debug(
`Started execution of workflow "${workflow.name}" from webhook with execution ID ${executionId}`,
{ executionId },
);

View File

@@ -180,7 +180,7 @@ export function executeErrorWorkflow(
// To avoid an infinite loop do not run the error workflow again if the error-workflow itself failed and it is its own error-workflow.
const { errorWorkflow } = workflowData.settings ?? {};
if (errorWorkflow && !(mode === 'error' && workflowId && errorWorkflow === workflowId)) {
logger.verbose('Start external error workflow', {
logger.debug('Start external error workflow', {
executionId,
errorWorkflowId: errorWorkflow,
workflowId,
@@ -222,7 +222,7 @@ export function executeErrorWorkflow(
workflowId !== undefined &&
workflowData.nodes.some((node) => node.type === errorTriggerType)
) {
logger.verbose('Start internal error workflow', { executionId, workflowId });
logger.debug('Start internal error workflow', { executionId, workflowId });
void Container.get(OwnershipService)
.getWorkflowProjectCached(workflowId)
.then((project) => {

View File

@@ -238,7 +238,7 @@ export class WorkflowRunner {
additionalData.executionId = executionId;
this.logger.verbose(
this.logger.debug(
`Execution for workflow ${data.workflowData.name} was assigned id ${executionId}`,
{ executionId },
);

View File

@@ -194,7 +194,7 @@ export class EnterpriseWorkflowService {
nodesWithCredentialsUserDoesNotHaveAccessTo.forEach((node) => {
if (isTamperingAttempt(node.id)) {
this.logger.verbose('Blocked workflow update due to tampering attempt', {
this.logger.warn('Blocked workflow update due to tampering attempt', {
nodeType: node.type,
nodeName: node.name,
nodeId: node.id,

View File

@@ -96,7 +96,7 @@ export class WorkflowService {
]);
if (!workflow) {
this.logger.verbose('User attempted to update a workflow without permissions', {
this.logger.warn('User attempted to update a workflow without permissions', {
workflowId,
userId: user.id,
});
@@ -120,7 +120,7 @@ export class WorkflowService {
// Update the workflow's version when changing properties such as
// `name`, `pinData`, `nodes`, `connections`, `settings` or `tags`
workflowUpdateData.versionId = uuid();
this.logger.verbose(
this.logger.debug(
`Updating versionId for workflow ${workflowId} for user ${user.id} after saving`,
{
previousVersionId: workflow.versionId,

View File

@@ -309,7 +309,7 @@ export class WorkflowsController {
);
if (!workflow) {
this.logger.verbose('User attempted to access a workflow without permissions', {
this.logger.warn('User attempted to access a workflow without permissions', {
workflowId,
userId: req.user.id,
});
@@ -362,7 +362,7 @@ export class WorkflowsController {
const workflow = await this.workflowService.delete(req.user, workflowId);
if (!workflow) {
this.logger.verbose('User attempted to delete a workflow without permissions', {
this.logger.warn('User attempted to delete a workflow without permissions', {
workflowId,
userId: req.user.id,
});