Skip to content

Feature Request: Improved logic for truncation of context #86

@psychedelicious

Description

@psychedelicious

Would like to be able to configure these options or maybe have a different way to gauge the size of the context.

I see there's a commit to bump width to 30 (CI failed, maybe a release was intended?). Even then, 30 keys could be a totally reasonable context size.

Ideas

  • Make width and breadth configurable.
  • Make this opt-in/out, perhaps depending on logger instance or log level or something.
  • Use a more accurate measure of object size e.g. JSON.stringify(data).length > maxCharCount. I suppose that would require two stringifications. Could keep track of the size as you stringify, and only start truncating once you hit the limit. Not sure if there is any prior art here.

Alternatives

The implementation of the serializer in roarr is conveniently very minimal and it's trivial to set your own.

I think it makes sense to have very conservative defaults and maybe even leave the max breadth at 10.

So all that said, I'm happy for this to be immediately closed, unless you think it's worth more discussion.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions