Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Use BoundedAttributes instead of raw dict to extract attributes from LogRecord #3114

Closed
@findmyway

Description

@findmyway

def _get_attributes(record: logging.LogRecord) -> Attributes:
attributes = {
k: v for k, v in vars(record).items() if k not in _RESERVED_ATTRS
}

In the latest main branch, attributes extracted from a LogRecord use dict directly. Better to use the BoundedAttributes from API to avoid some corner cases, like invalid value type or messages of long length.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions