Skip to content

Commit

Permalink
chore: update debug level condition
Browse files Browse the repository at this point in the history
- add destType in cdkv2 handler
- include extra fields in fillExcept logger option
  • Loading branch information
Sai Sankeerth committed Jun 14, 2024
1 parent fe87faa commit cbb9354
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/cdk/v2/handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@ export async function processCdkV2Workflow(
bindings: Record<string, FixMe> = {},
) {
try {
logger.debug(`Processing cdkV2 workflow`);
logger.debug(`Processing cdkV2 workflow`, { destType });

const workflowEngine = await getCachedWorkflowEngine(destType, feature, bindings);
return await executeWorkflow(workflowEngine, parsedEvent, requestMetadata);
} catch (error) {
Expand Down
16 changes: 14 additions & 2 deletions src/logger.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,19 @@ const loggerImpl = process.env.LOGGER_IMPL ?? 'winston';

let logLevel = process.env.LOG_LEVEL ?? 'error';

const logger = structuredLogger({ level: logLevel });
const logger = structuredLogger({
level: logLevel,
fillExcept: [
'destinationId',
'sourceId',
'destinationType',
'workspaceId',
'module',
'implementation',
'feature',
'destType',
],
});

const getLogger = () => {
switch (loggerImpl) {
Expand Down Expand Up @@ -77,7 +89,7 @@ const log = (logMethod, args) => {

const debug = (...args) => {
const logger = getLogger();
if (LOGLEVELS.debug <= logLevel) {
if (LOGLEVELS.debug <= LOGLEVELS[logLevel]) {
log(logger.debug, args);
}
};
Expand Down

0 comments on commit cbb9354

Please sign in to comment.