Skip to content
Discussion options

You must be logged in to vote

Hi @shareefer, by default we remove null, undefined, and '', this however applies only to top-level key/value pairs. If your null value is within an object we'll log it.

For example:

import { Logger } from '@aws-lambda-powertools/logger';

const logger = new Logger();

const nullVal = null;

logger.info('some val', nullVal); // key: nullVal - value: null -> removed
logger.info('some other val', { nullVal }); // key: extra - value: null -> removed

const comparison = {
  before: true,
  after: null
};

logger.info('wrapped', { comparison }); // not removed, see below
// {"level":"INFO","message":"wrapped","timestamp":"2025-08-28T22:35:30.694Z","service":"service_undefined","sampling_rate":…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@shareefer
Comment options

Answer selected by shareefer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants